0
Hi I need help to this question. I hope someone take time and help me thanks.
write a program to read a set o (5) real numbers and find the average of them ???
3 Antworten
+ 9
#include <iostream>
using namespace std;
int main() {
double a, b, c, d, e, avg=0.;
cin>>a>>b>>c>>d>>e;
avg=(a+b+c+d+e)/5;
cout<<avg;
return 0;
}
+ 3
Create 5 float variables.
cin >> variable // 5 times
float sum = // add all variables
float average = sum / 5;
cout << average << endl;
0
thanks for both
I tryed Filip.s but I just wrote the numbers in the black thingi but I didnt get average back why?? is my fault my pc or something?? I am confused