Answer to Question #218720 in C++ for abc deefgh

Question #218720

enter the first number, second number, and third number

calculate the sum by adding together the first number, second number, and third number

calculate the average by dividing the sum by 3

display the average


1
Expert's answer
2021-07-19T17:00:01-0400
#include<iostream>
using namespace std;

int main()
{
    int n1,n2,n3;
    double sum,avg;
   
    cout<<"\nEnter first number";
    cin>>n1;
   
    cout<<"\nEnter second number";
    cin>>n2;
   
    cout<<"\nEnter third number";
    cin>>n3;
   
    sum=n1+n2+n3;
   
    avg=sum/3.0;
   
    cout<<"\nSum= "<<sum;
    cout<<"\nAverage= "<<avg;
   
    return 0;
}

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