Input
A line containing five integers separated by a space.
1·2·3·4·5
Output
A line containing an integer.
4084101
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int numbers[5];
for(int i=0;i<5;i++){
cin>>numbers[i];
}
//Add the 1st and 2nd integers together and store the sum inside a variable.
int sum12=numbers[0]+numbers[1];
//Add the 3rd and 4th integers together and store the sum inside a variable.
int sum34=numbers[2]+numbers[3];
//Multiply the two sums and raise the product result to the power of the 5th integer.
long int product=sum12*sum34;
long int result=pow(product,numbers[4]*1.0);
//Print out the result.
cout<<result<<"\n\n";
system("pause");
return 0;
}
Comments
Leave a comment