Write a C++ Program to Find Sum and Average of three numbers.
Soluion:
/* 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<<"
Enter 2nd number :: ";
cin>>b;
cout<<"
Enter 3rd number :: ";
cin>>c;
sum=a+b+c;
avg=sum/3;
cout<<"
The SUM of 3 Numbers [ "<<a<<" + "<<b<<" + "<<c<<" ] = "<<sum<<"
";
cout<<"
The AVERAGE of 3 Numbers [ "<<a<<", "<<b<<", "<<c<<" ] = "<<avg<<"
";
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
Is This Answer Correct ? | 0 Yes | 0 No |
explain the term 'resource acquisition is initialization'?
What is static variable and difference between(const char *p,char const *p,const char* const p).
Difference between Call by pointer and by reference.
what is the difference between a pointer and a reference?
0 Answers Amazon, Blue Star, C DAC,
What is the difference between malloc, calloc and realloc?
What Is A Conversion Constructor C++ ?
What is constant keyword in C++? Illustrate its various uses.
0 Answers Akamai Technologies, Infogain,
What is a constructor initializer list?
what is friend function in C++?
What kind of problems does name mangling cause?
dynamic scoping is
Describe the different styles of function prototypes in C++.