-->

Facebook

Jasper Roberts - Blog

Saturday, April 4, 2015

Write a C++ Program to calculate average and sum.

#include<iostream.h>
//using namespace std;
void main()
{
float x,y,s,a;
cout<<"Enter the number : "<<"\n";
cin>>x>>y;
s=x+y;
a=s/2;
cout<<"\nSum = "<<s;
cout<<"\nAvg = "<<a;
}

OUTPUT:
Enter the number: 10
10
Sum = 20
Avg = 10

No comments:

Post a Comment