Q) Write a program to find and display the sum, average and product of three numbers entered by the user.
Source code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n1,n2,n3,total,avg,product;
cout<<"Enter 3 numbers"<<endl;
cin>>n1>>n2>>n3;
total=n1+n2+n3;
avg=(n1+n2+n3)\/3;
product=n1*n2*n3;
cout<<"Total="<<total<<endl;
cout<<"Average="<<avg<<endl;
cout<<"Product="<<product<<endl;
getch();
}
Output:
No comments:
Post a Comment