Guest User

Untitled

a guest
Nov 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     float salaryPerWeek, totalHours, salPerHour, hoursOver, salPerHourOver, endSal;
  8.  
  9.     while(1)
  10.     {
  11.         printf("Enter a salary per week:\n");
  12.         scanf("%f", &salaryPerWeek);
  13.  
  14.         printf("Enter total number of hours worked:\n");
  15.         scanf("%f", &totalHours);
  16.  
  17.         if(totalHours > 168)
  18.         {
  19.             printf("There are only 168 hours in a week...");
  20.         } else if(totalHours < 40)
  21.             {
  22.                 printf("You need to work at least 40 hours...");
  23.             }
  24.  
  25.         salPerHour = salaryPerWeek / 40;
  26.         hoursOver = totalHours - 40;
  27.         //salPerHourOver = hoursOver * (salPerHour * 2);
  28.  
  29.         endSal = salaryPerWeek + (hoursOver * salPerHour * 2);
  30.  
  31.         printf("Here is the person's salary after 1 week: %f", &endSal);
  32.         printf("\n\n");
  33.     }
  34.  
  35.     return 0;
  36. }
Add Comment
Please, Sign In to add comment