Social Icons

Saturday, 15 February 2014

Program to calculate sum and average of three numbers

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();         //to clear the screen
float a,b,c,sum,avg;
cout<<"\n\t\t Enter three numbers  ";
cout<<"\n Enter first number : ";
cin>>a;
cout<<"\n Enter second number : ";
cin>>b;
cout<<"\n Enter third number : ";
cin>>c;

sum=a+b+c;
avg=sum/3;
cout<<"\n\t SUM = "<<sum;
cout<<"\n\t Average = "<<avg;

getch();         //to stop the screen
}


                                                    Output



No comments:

Post a Comment