fork download
  1. #include <stdio.h>
  2. #define BASE 10.0
  3. #define OVER 1.5
  4. #define FIRST .15
  5. #define SECOND .2
  6. #define THIRD .05
  7. int main()
  8. {
  9. int hours;
  10. float all_payment, first_tax, second_tax, thrd_tax;
  11. printf("Give me hours: \n");
  12. scanf("%d", &hours);
  13.  
  14. all_payment = (hours < 40)? hours * BASE: ((hours * BASE) - 40)
  15. * OVER;
  16. if (all_payment >= 300)
  17. first_tax = all_payment - (300 * FIRST);
  18. else if (all_payment >= 450)
  19. second_tax = all_payment - (150 * SECOND);
  20. else
  21. thrd_tax = (all_payment - 450) - ((all_payment - 450) * THIRD);
  22.  
  23.  
  24.  
  25. printf("Payment without taxes: %f\n", all_payment);
  26.  
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 2172KB
stdin
Standard input is empty
stdout
Give me hours: 
Payment without taxes: -1451258112.000000