Answer to Question #286799 in C for bob

Question #286799

Sum Cubes

by CodeChum Admin

The square of an integer refers to the result of multiplying the integer with itself once. While the cube of an integer refers to the result of multiplying the integer with itself twice. As long as you know that, you could easily solve this!


Instructions:

  1. Input three integers and compute the cubes of each of them.
  2. Check if the sum of the cubes are positive. If it is, print out "Positive", and if not, print out "Negative".

Input


1. First integer

2. Second integer

3. Third integer

Output


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

The last line contains "Positive" or "Negative"


Enter the first integer: 1
Enter the second integer: 2
Enter the third integer: 3
Positive


Enter the first integer: 1
Enter the second integer: -5
Enter the third integer: 4
Negative
1
Expert's answer
2022-01-12T05:10:36-0500
#include <stdio.h>

int main()
{
    int a, b, c;
    printf("%s", "Enter the first integer: ");
    scanf("%d", &a);
    printf("%s", "Enter the second integer: ");
    scanf("%d", &b);
    printf("%s", "Enter the third integer: ");
    scanf("%d", &c);
    int result = a * a * a + b * b * b + c * c *c;
    if(result >= 0)
    {
        printf("%s", "Positive ");
    }
    else
    {
        printf("%s", "Negative ");
    }
    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