Advertisement
Guest User

ShitCode

a guest
Feb 6th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.53 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.  
  5.   int numEmployees, salary = 200, total;
  6.   float comm;
  7.   int payBracket[] = {0,0,0,0,0,0,0,0,0};
  8.  
  9.   printf("Enter number of Employees: ");
  10.   scanf("%d", &numEmployees);
  11.  
  12.   int i;
  13.   for (i = 0; i < numEmployees; i++) {
  14.  
  15.     printf("Enter Commission for Employee %d: ", i+1);
  16.     scanf("%f", &comm);
  17.  
  18.     total = salary + (comm / 100) * 9;
  19.  
  20.     if (total >= 200 && total <= 299) {
  21.       payBracket[0]++;
  22.     }
  23.     else if (total >= 300 && total <= 399) {
  24.       payBracket[1]++;
  25.     }
  26.     else if (total >= 400 && total <= 499) {
  27.       payBracket[2]++;
  28.     }
  29.     else if (total >= 500 && total <= 599) {
  30.       payBracket[3]++;
  31.     }
  32.     else if (total >= 600 && total <= 699) {
  33.       payBracket[4]++;
  34.     }
  35.     else if (total >= 700 && total <= 799) {
  36.       payBracket[5]++;
  37.     }
  38.     else if (total >= 800 && total <= 899) {
  39.       payBracket[6]++;
  40.     }
  41.     else if (total >= 900 && total <= 999) {
  42.       payBracket[7]++;
  43.     }
  44.     else if (total >= 1000) {
  45.       payBracket[8]++;
  46.     }
  47.  
  48.     printf("Employee %d Total Pay: %d\n", i+1, total);
  49.  
  50.   }
  51.  
  52.   printf("\n200 - 299 : %d\n", payBracket[0]);
  53.   printf("300 - 399 : %d\n", payBracket[1]);
  54.   printf("400 - 499 : %d\n", payBracket[2]);
  55.   printf("500 - 599 : %d\n", payBracket[3]);
  56.   printf("600 - 699 : %d\n", payBracket[4]);
  57.   printf("700 - 799 : %d\n", payBracket[5]);
  58.   printf("800 - 899 : %d\n", payBracket[6]);
  59.   printf("900 - 999 : %d\n", payBracket[7]);
  60.   printf("1000+ : %d\n", payBracket[8]);
  61.  
  62.   return 0;
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement