Answer to Question #267335 in C++ for CjA

Question #267335
  1. Input five integers in one line, with each integer separated by a space.
  2. Add the 1st and 2nd integers together and store the sum inside a variable.
  3. Add the 3rd and 4th integers together and store the sum inside a variable.
  4. Multiply the two sums and raise the product result to the power of the 5th integer.
  5. Print out the result.
1
Expert's answer
2021-11-17T06:30:05-0500
#include <iostream>
#include <cmath>


using namespace std;


int main()
{   int p[5], a, b, c;
    //Input five integers in one line, with each integer separated by a space
    cout << "Enter five integers separated by space: "<< endl;
    for (int i=0; i<5; ++i)
    {
         cin>>p[i];
    }
    //Add the 1st and 2nd integers together and store the sum inside a variable
    a=p[0]+p[1];
    //Add the 3rd and 4th integers together and store the sum inside a variable.
    b=p[2]+p[3];
    //Multiply the two sums and raise the product result to the power of the 5th integer
    c=pow((a*b), p[4]);
    //Print out the result.
    cout<<"The value is: "<<c<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS