0

Hovercraft. I need help with this c challenge.

#include <stdio.h> int main() { int hc, total, gtotal; int cost = 2000000; const int insu = 1000000; char gain[10] = {'P', 'r', 'o', 'f', 'i', 't'}; char lost[5] = {'L', 'o', 's', 's'}; char broke[15] = {'B', 'r', 'o', 'k', 'e', ' ', 'E', 'v', 'e', 'n'}; printf("How many hovercraft did you sell? \n"); scanf("%d", &hc); cost *= 10; total = hc * 3000000; gtotal = total - cost - insu; if(gtotal > 0) { printf("%s", gain); } else if(gtotal == 0) { printf ("%s", broke ); } else { printf ("%s", lost); } return 0; }

31st Jul 2020, 5:49 PM
Sammy White
2 Respostas
31st Jul 2020, 6:11 PM
Sammy White
0
Thanks codemonkey
31st Jul 2020, 9:47 PM
Sammy White