Finding the largest number from the rand()!.:Resolved:.
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
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;
}
THis finds the sum of the 80 random integers, but how would I get to compare the random integers?
ANy ideas?
Thanks!:wave: