Untitled
unknown
plain_text
a year ago
890 B
6
Indexable
#include <stdio.h> int main(void) { double earnings1, earnings2, earnings3, totalEarnings; // Ask the user to input three decimal values printf("Enter decimal value 1: "); scanf("%lf", &earnings1); printf("Enter decimal value 2: "); scanf("%lf", &earnings2); printf("Enter decimal value 3: "); scanf("%lf", &earnings3); // Calculate the total earnings totalEarnings = earnings1 + earnings2 + earnings3; // Categorize wealth based on total earnings and print the corresponding message if (totalEarnings < 200000) { printf("average\n"); } else if (totalEarnings >= 200000 && totalEarnings < 400000) { printf("rich\n"); } else if (totalEarnings >= 400000 && totalEarnings < 600000) { printf("super rich\n"); } else { printf("crazy rich\n"); } return 0; }
Editor is loading...
Leave a Comment