- 1
Average of 5 inputed numbers
explain me how.
4 Réponses
+ 2
thank you hinanawi 😊😘
+ 1
put this inside main():
int a, sum;
for(int i = 0; i < 5; i++)
{
cin >> a;
sum += a;
}
cout << (sum / 5.0);
+ 1
can't understand this, can you explain me how you can do that?
+ 1
Maria Antonette Duran well, this code lets you input 5 numbers, and adds them all into one sum, then divides that by 5. that's how you get the average of the 5 numbers