by CodeChum Admin
We've been dealing with integers too much, it's time for float to shine!
Instructions:
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
#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;
}
Comments
Leave a comment