write a program in c++ that calculate sum average and product of three numbers and print them in separate line
Attachments:

Answers
Answered by
8
Solution:
The given códe is written in C++.
#include <iostream>
using namespace std;
int main(){
double a,b,c,sum,average,product;
cout<<"Enter first number: ";
cin>>a;
cout<<"--------------------";
cout<<"\nEnter second number: ";
cin>>b;
cout<<"--------------------";
cout<<"\nEnter third number: ";
cin>>c;
cout<<"--------------------";
cout<<"\n--------------------";
sum=a+b+c;
average=sum/3.0;
product=a*b*c;
cout<<"\nSum of the numbers: "<<sum;
cout<<"\nAverage of the numbers: "<<average;
cout<<"\nProduct of the numbers: "<<product;
return 0;
}
Logic:
- Take three numbers - a, b and c as input.
- Add a, b and c and store the result in 'sum' variable.
- Display the 'sum'.
- Divide sum by 3.0 and store the result in 'average' variable.
- Display the 'average'.
- Multiply a, b and c and store the result in 'product' variable.
- Display the 'product'.
•••♪
Attachments:


Answered by
0
hope it will help you
all the best
Attachments:

Similar questions