Average of three numbers in C++
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
float avg;
clrscr();
//read the three numbers
cout<<endl<<"Enter the value of a ,b, and c:";
cin>>a>>b>>c;
//calculate the average
avg=(a+b+c)/3.0;
//display the average
cout<<endl<<"Average = " <<avg;
getch();
}
Comments
Post a Comment