Program that calculates the average of 5 numbers that can be input by user.
#include <iostream.h>
main()
{
int num1, num2, num3, num4, num5, average;
cout<<"enter number 1";
cin>>num1;
cout<<"enter number 2";
cin>>num2;
cout<<"enter number 3";
cin>>num3;
cout<<"enter number 4";
cin>>num4;
cout<<"enter number 5";
cin>>num5;
average=(num1+num2+num3+num4+num5)/5;
cout<<"average for five number is=" , average;
}
No comments:
Post a Comment