Answer to Question #326234 in C for nile2020

Question #326234

5. Float Galore

by CodeChum Admin

We've been dealing with integers too much, it's time for float to shine!


Instructions:

  1. Input five float numbers.
  2. Print out the float numbers in one line, separated by spaces, and make sure you only print up to 1 decimal place.
  3. Add the first four float numbers and check if their sum is greater than the fifth float number. Print out "Yes" if they are.

Input


1. First float number

2. Second float number

3. Third float number

4. Fourth float number

5. Fifth float number

Output

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

The next line contains the inputted float numbers.

The last line contains "Yes" if the condition is true.

Enter·the·first·number:·1.1
Enter·the·second·number:·1.2
Enter·the·third·number:·1.3
Enter·the·fourth·number:·1.4
Enter·the·fifth·number:·1.1
1.1·1.2·1.3·1.4·1.1
Yes
1
Expert's answer
2022-04-09T17:54:19-0400
#include <stdio.h>


int main() {
    float x1, x2, x3, x4, x5;


    printf("Enter the first number: ");
    scanf("%f", &x1);
    printf("Enter the second number: ");
    scanf("%f", &x2);
    printf("Enter the third number: ");
    scanf("%f", &x3);
    printf("Enter the fourth number: ");
    scanf("%f", &x4);
    printf("Enter the fifth number: ");
    scanf("%f", &x5);


    printf("%.1f %.1f %.1f %.1f\n", x1, x2, x3, x4);
    if (1+x2+x3+x4 > x4) {
        printf("Yes\n");
    }
    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