Program for average of 4 numbers in C++

 Program for average of 4 numbers in C++:

#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
double avg;
cout<<"enter any four no";
cin>>a>>b>>c>>d;
avg=(a+b+c+d)/4;
cout<<"average is "<<avg;
return 0;

}

output:
enter any four no1
2
3
4
average is 2

Comments