WAP to store three numbers. Now calculate and display their sum and product
Answers
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'.
Answer:
Is the program in java or basic please specify
Explanation:
Please repost you question