free c programming course
Tuesday, 20 December 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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment