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 numbersn”;
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




Leave a Reply

Your email address will not be published.