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 ???

25th Jan 2017, 7:14 PM
Daravan Daro
Daravan Daro - avatar
3 Respostas
+ 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; }
25th Jan 2017, 8:07 PM
Filip
Filip - avatar
+ 3
Create 5 float variables. cin >> variable // 5 times float sum = // add all variables float average = sum / 5; cout << average << endl;
25th Jan 2017, 7:32 PM
Jafca
Jafca - avatar
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
25th Jan 2017, 8:18 PM
Daravan Daro
Daravan Daro - avatar