Computer Science, asked by ar510026, 3 months ago

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

Attachments:

Answers

Answered by anindyaadhikari13
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:

  1. Take three numbers - a, b and c as input.
  2. Add a, b and c and store the result in 'sum' variable.
  3. Display the 'sum'.
  4. Divide sum by 3.0 and store the result in 'average' variable.
  5. Display the 'average'.
  6. Multiply a, b and c and store the result in 'product' variable.
  7. Display the 'product'.

•••♪

Attachments:
Answered by shankark33
0

hope it will help you

all the best

Attachments:
Similar questions