Answer to Question #264018 in C for topher

Question #264018

6. Integer Pairing

by CodeChum Admin

Now this one's a tad bit tricky, but you can definitely do it!


Instructions:

  1. Input five integers.
  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.

Input


1. First integer

2. Second integer

3. Third integer

4. Fourth integer

5. Fifth integer

Output

The first five lines will contain message prompts to input the five integers.

The line contains the result.

Enter·integer·1:·2
Enter·integer·2:·3
Enter·integer·3:·3
Enter·integer·4:·5
Enter·integer·5:·4
Result·=·2560000





1
Expert's answer
2021-11-10T09:36:26-0500
#include <stdio.h>
#include <math.h>

int main() {
    int i1, i2, i3,  i4, i5;
    int sum1, sum2, prod, res;

    printf("Enter first integer: ");
    scanf("%d", &i1);
    printf("Enter second integer: ");
    scanf("%d", &i2);
    printf("Enter third integer: ");
    scanf("%d", &i3);
    printf("Enter fourth integer: ");
    scanf("%d", &i4);
    printf("Enter fifth integer: ");
    scanf("%d", &i5);
    
    sum1 = i1 + i2;
    sum2 = i3 + i4;
    prod = sum1 * sum2;
    res = pow(prod, i5);
    printf("Result = %d\n", res);

    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