Popular Posts

3.Write a program to show sum and average for given two numbers.

3.Write a program to show sum and average for given two numbers.

#include
#include
int main()
{
clrscr();
float num1,num2,sum,avrg;
cout<<"Enter number1: "; cin>>num1;
cout<<"Enter number2: "; cin>>num2;
sum=num1+num2;
avrg=sum/2;
cout<<"The sum of two numbers is: "< cout<<"The avrg of two numbers is: "< getch();
return 0;
}

Output:

Enter number1: 10
Enter number2: 20
The sum of two numbers is: 30
The avrg of two numbers is: 15

No comments: