Write a program that take four floating numbers from keyboard and prints their sum, product and average.

Write a program that takes four floating numbers from the keyboard and prints their sum, product, and average.

Write a program that take four floating numbers from keyboard and prints their sum, product and average.

Code:

#include<iostream>

#include<conio.h>

using namespace std;

void main()

{

       float n1,n2,n3,n4,sum,pro,avg;

       cout<<“Please Enter Any Four Numbers.\n\n”;

       cin>>n1>>n2>>n3>>n4;

       sum= n1+n2+n3+n4;

       pro= n1*n2*n3*n4;

       avg= (n1+n2+n3+n4)/4;

       cout<<“\nAddition of Four Number is: “<<sum<<endl;

       cout<<“Product of Four Number is : “<<pro<<endl;

       cout<<“Avg of Four Number is     : “<<avg<<endl;

       getch();

}

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
	float n1,n2,n3,n4,sum,pro,avg;
	cout<<"Please Enter Any Four Numbers.\n\n";
	cin>>n1>>n2>>n3>>n4;
	sum= n1+n2+n3+n4;
	pro= n1*n2*n3*n4;
	avg= (n1+n2+n3+n4)/4;
	cout<<"\nAddition of Four Number is: "<<sum<<endl;
	cout<<"Product of Four Number is : "<<pro<<endl;
	cout<<"Avg of Four Number is     : "<<avg<<endl;

	getch();
}

 

Output:

Write a program that take four floating numbers from keyboard and prints their sum, product and average.

 

 

 

 

 

C++ projects for beginners with source code

Leave a Comment

Your email address will not be published. Required fields are marked *