Write a program using while structure that allows you to enter 10 integer numbers and it prints out the largest of the numbers after completion of the entry.
Counter : Keeps the count of the entry
Number : Current number input into the program
Largest : The largest number found .
1
Expert's answer
2012-12-19T11:17:15-0500
#include <iostream> #define Counter 10
using namespace std;
int main(int argc, const char * argv[]) { int i=1,number,largest=0;
while (i<=Counter) { & & cin>>number; & & if (largest<number) { largest = number; & } & ++i; } cout << largest; return 0; }
Comments
Leave a comment