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


Expert's answer

#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;
}
LATEST TUTORIALS
APPROVED BY CLIENTS