Answer to Question #254614 in C++ for Joshuu

Question #254614
Write a c program to prompt the user to enter 3 integers namely: temp ,tent ,teep as variables names .The program should compare the integers and display the cube of the smallest.
1
Expert's answer
2021-10-21T07:23:03-0400
#include <stdio.h>
#include <stdlib.h>
int main()
{
    //temp ,tent ,teep as variables names
    int temp, tent,teep,cube;
    // prompt the user to enter 3 integers
    printf("\nInput the first integer: ");
    scanf("%d", &temp);
    printf("\nInput the second integer: ");
    scanf("%d", &tent);
    printf("\nInput the third integer: ");
    scanf("%d", &teep);
    //The program should compare the integers and display the cube of the smallest.
    if ((temp<tent) && (temp<teep)){
        cube = temp*temp*temp;
        printf("\nThe cube of the smallest number %d .",cube);
        }
    else if ((tent<temp) && (tent<teep)){
        cube = tent*tent*tent;
        printf("\nThe cube of the smallest number %d .",cube);
    }
     else if ((teep<tent) && (teep<temp)){
        cube = teep*teep*teep;
        printf("\nThe cube of the smallest number %d .",cube);
    }
    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