Answer to Question #203984 in C++ for Khojo

Question #203984

Write the algorithm and pseudocode for finding the average of five(5) numbers.


1
Expert's answer
2021-06-06T13:00:14-0400
#include <bits/stdc++.h>


using namespace std;


double a, b, c, d, e;


int main()
{
	cin >> a >> b >> c >> d >> e;
	double avg = (a+b+c+d+e)/5;
	cout << "Average: " << avg;
	
    return 0;
}



Pseudocode:

Initializing five variables a, b, c, d, e;
Finding the average avg = (a+b+c+d+e) / 5;
Printing the result (avg);



Sample Input 1:
2 3 1 4 5

Sample Output 1:
3

Sample Input 2:
2 2 1 5 7

Sample Output 2:
3.4

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog