Wednesday, 4 August 2021

Program to find and display the Sum, Average and Product of three numbers.

 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:

Output_3



No comments:

Post a Comment

Program to find and display area, circumference and diameter of a circle in C++.

Write a C++ program to find and display area, circumference and diameter of a circle.  Source code: #include<iostream.h> #include<c...