56.4k views
1 vote
Write a C++ program that reads four double precision numbersfrom the screen using the variables x1,x2,x3 and x4. The programthen adds them together multiplies the sum by the quantityx1*x2*x3*x4 and then prints the final result to the screen withappropriate label.

User Dasuma
by
8.0k points

1 Answer

7 votes

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

double x1,x2,x3,x4,sum,output;//declaring variables..

cout<<"Enter the variables"<<endl;

cin>>x1>>x2>>x3>>x4;//taking input of the time...

sum=x1+x2+x3+x4;//calculating the sum...

output=sum*x1*x2*x3*x4;

cout<<"The asnwer is "<<output<<endl;//printing the temperature..

return 0;

}

Step-by-step explanation:

I have taken 6 double variables sum to hold the sum of variables and output is to hold the answer.Then calculating printing the output.

User Ghbarratt
by
7.5k points