fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float sales, commission;
  5.  
  6. // Input sales amount
  7. printf("Enter the sales amount: ");
  8. scanf("%f", &sales);
  9.  
  10. // Calculate commission based on the sales amount
  11. if (sales > 5000000) {
  12. commission = sales * 0.15;
  13. } else if (sales > 2500000) {
  14. commission = sales * 0.10;
  15. } else if (sales > 1000000) {
  16. commission = sales * 0.05;
  17. } else if (sales > 500000) {
  18. commission = sales * 0.02;
  19. } else {
  20. commission = sales * 0.01;
  21. }
  22.  
  23. // Output the commission
  24. printf("The commission is: %.2f\n", commission);
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
Enter the sales amount: The commission is: 0.00