Advertisement
Kulas_Code20

Salesman's Sales

Oct 30th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main() {
  4.     float salesAmount = 0;
  5.     int numberOfSalesman = 0;
  6.     int twentyPercent=0, fifteenPercent=0, thirteen=0, zero=0;
  7.  
  8.     printf("Salesmans's Sales Generator\n");
  9.     printf("Enter how many salesman (Maximum of 50): ");
  10.     scanf("%d", &numberOfSalesman);
  11.    
  12.     printf("\n");
  13.     int i = 1;
  14.     while (i <= numberOfSalesman) {
  15.         printf("Enter salesman %d sales: ", i);
  16.         scanf("%f", & salesAmount);
  17.  
  18.         if (salesAmount > 20000) {
  19.             twentyPercent++;
  20.         }
  21.         if (salesAmount >= 15000 && salesAmount <= 20000) {
  22.             fifteenPercent++;
  23.         }
  24.         if (salesAmount < 15000) {
  25.             thirteen++;
  26.         }
  27.         if (salesAmount == 0) {
  28.             zero++;
  29.         }
  30.         i++;
  31.     }
  32.  
  33.     printf("\nTotal Commission 20%%: %d \n", twentyPercent);
  34.     printf("Total commission 15%%: %d \n", fifteenPercent);
  35.     printf("Total commission 13%%: %d \n", thirteen);
  36.     printf("Zero Commission: %d", zero);
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement