C++ Program to Find Sum and Average of three numbers

By | 24.12.2016

Sum and Average of three numbers


Write a C++ Program to Find Sum and Average of three numbers. Here’s simple C++ Program to Find Sum and Average of three numbers in C++ Programming Language.


Here is source code of the C++ Program to Find Sum and Average of three numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :


/* C++ Program to Find Sum and Average of three numbers  */

#include<iostream>
using namespace std;

int main()
{
    float a,b,c,sum,avg;
    cout<<"Enter 1st number :: ";
    cin>>a;
    cout<<"\nEnter 2nd number :: ";
    cin>>b;
    cout<<"\nEnter 3rd number :: ";
    cin>>c;

    sum=a+b+c;

    avg=sum/3;

    cout<<"\nThe SUM of 3 Numbers [ "<<a<<" + "<<b<<" + "<<c<<" ] = "<<sum<<"\n";
    cout<<"\nThe AVERAGE of 3 Numbers [ "<<a<<", "<<b<<", "<<c<<" ] = "<<avg<<"\n";

    return 0;
}

OUTPUT : :


/* C++ Program to Find Sum and Average of three numbers  */

Enter 1st number :: 3

Enter 2nd number :: 4

Enter 3rd number :: 5

The SUM of 3 Numbers [ 3 + 4 + 5 ] = 12

The AVERAGE of 3 Numbers [ 3, 4, 5 ] = 4

Process returned 0

Above is the source code for C++ Program to Find Sum and Avg. of three numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

3.8 12 votes
Article Rating
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Beatrice Sibanda

Thank you

Joseph Oloo

Thanks for your answer, really helped me!

Varshini

Thank you

Varshini

Thank you so much.this is very helpful for me😊

Yoga

me to

ubaid

sext mahool