I have some code, and while most of it works, the final part of it does not. I have looked for the mistake in the code for quite a while, but I have been unable to. (It's probably something obvious too...)
Anyhow, here are the results of my last compile.
#include <stdio.h>
main()
{ int s_code, c_code;
double sale_amount, sale_comm;
printf("Salesperson code: ");
scanf("%d", &s_code);
printf("Customer code: ");
scanf("%d", &c_code);
printf("Sale amount in dollars and cents: ");
scanf("%5.2lf", &sale_amount);
printf("\n\n SALES REPORT");
printf("\nSalesperson Code: %7d", s_code);
printf("\n Customer Code: %7d", c_code);
printf("\n\n Sale Amount: $%7.2lf", sale_amount);
sale_comm = sale_amount * 0.144;
printf("\n Commission: $%7.2lf", sale_comm);
}
Salesperson code: 14
Customer code: 134
Sale amount in dollars and cents: 24
SALES REPORT
Salesperson Code: 14
Customer Code: 134
Sale Amount: $ 0.00
Commission: $ 0.00
Obviously the sale amount and commission aren't supposed to be zero, but I have racked my brains for a long time on this problem. Thanks in advance for your help.