So How many Hours did you work?
> 41
How many Holiday and Sunday Hours did you have? IF any!
> 10
How many Overtime hours did you work? If any!
> 5
Your pay this week will be $53
joe@ubuntu:~$
Seems to work here.
One thing I noticed quickly is that you will output the line "Your pay this week will be $x" twice if the user has worked < 40 hrs.
You should move this:
Code:
check = ((hlhrs * 2) + (ot * 1.5) + (hours - (hlhrs + ot)));
printf("Your pay this week will be $%d", check);
into here:
Code:
else if (hours > 40) {
printf("How many Holiday and Sunday Hours did you have? IF any!\n> ");
scanf("%d", &hlhrs);
printf("How many Overtime hours did you work? If any!\n> ");
scanf("%d", &ot);
check = ((hlhrs * 2) + (ot * 1.5) + (hours - (hlhrs + ot)));
printf("Your pay this week will be $%d", check);
}
The following scanf() call fails to do any kind of bounds checking
Code:
char name[30];
..
scanf("%s", name);
What happens when the user enters a name > 30 characters?
It's also worth noting that you don't check the return values from your scanf().
As stated already, you should probably look into using fgets() for reading input from stdin.