Hello everyone!
I have a slight problem!
I'm suppose to generate 80 random numbers, then I need to find the sum of those random numbers, and the max of the random numbers! Here is my code
THis finds the sum of the 80 random integers, but how would I get to compare the random integers?Code:#include <iostream> #include <cstdlib> int main() { int sum = 0; int first, max; for(int i = 1; i <=80; i++) { cout << 10 + (rand() % 10) << endl; sum = sum + (10 + (rand()%10)); } cout <<"The sum is : " << sum << endl; return 0; }
ANy ideas?
Thanks!![]()




Reply With Quote