Tuesday, December 20, 2011

Calculate Average of Four Numbers in C++


//Write a Program to calculate average of four numbers
#include <iostream.h>
#include <conio.h>
void main ()
{
int a,b,c,d,avg;
clrscr ();
cout <<"Enter 5 Numbers";
cin >>a >>b >>c >>d;
avg =(a+b+c+d)/4;
cout <<"\n Average is: "<<avg;
getch ();
}

No comments:

Post a Comment