Header Ads Widget

Write a CPP program to calculate average of three numbers

 Code:-

#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
float avg;
cout<<"Enter three numbers\n";
cin>>a>>b>>c;
avg=(a+b+c)/3.0;
cout<<"Average of the numbers "<<a<<" "<<b<<" "<<"and"<<" "<<c<<" is : "<<avg;
return 0;
}

Output:-

Enter three numbers
12 13 14
Average of the 12 13 and 14 is : 13




Post a Comment

0 Comments