Answer to Question #225326 in C++ for Ulando

Question #225326

Write a program that will read integers and find the total and average of the input values. Your program should end when the input is 0.


1
Expert's answer
2021-08-14T01:39:22-0400
#include <iostream>


using namespace std;


int main()
{
    // let number of values is 5
    
    int a,b,c,d,e, sum;
    
    cout << "Enter the values:" << endl;
    cin >>a>>b>>c>>d>>e;
    
// finding sum of the values
    sum = (a+b+c+d+e) ;
    
    cout << "Sum of numbers is: "<< sum << endl;
// average is sum/5 
    cout << "Average is :"<< (sum / 5) << endl ;
}

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
APPROVED BY CLIENTS