41.7k views
2 votes
Write a program that asks the user how many integers they would like to enter. You can assume they will enter an integer> 1. The program will then prompt the user to enter that many integers. After all the numbers have been entered, the program should display the largest and smallest of those numbers (no, you cannot use arrays, or any other material we haven't covered). When you run your program it should match the following format: How many integers would you like to enter?

User Anilech
by
4.6k points

1 Answer

3 votes

Answer:

Explanation:#include <iostream>

using namespace std;

int main()

{

int x, val, average = 0;

cout << "how many integers you would like to enter: " << endl;

cin >> x;

for(int i=1;i<=x;i++)

{

cin >> val;

average+=val;

}

cout << average/x << endl;

return 0;

#include <iostream>

using namespace std;

int main()

{

int x, val, average = 0;

cout << "how many integers you would like to enter: " << endl;

cin >> x;

for(int i=1;i<=x;i++)

{

cin >> val;

average+=val;

}

cout << average/x << endl;

return 0;

User Alliah
by
5.0k points