forked from gouravthakur39/beginners-C-program-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DailyWageCalc.c
32 lines (30 loc) · 1.17 KB
/
DailyWageCalc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Program to find the daily wages of a worker according to the following
// conditions using ladder else if statement
// Given below is the Pay according to hour
// ---------------------------------------------------------------------
// Duty in hours Amount in rupees
// ----------------------------------------
// Within first 8 hours 100 Rupees
// Next 4 hours 20 Rupees/hour
// Next 4 hours 40 Rupees/hour
// Next 4 hours 60 Rupees/hour
// Next 4 hours 80 Rupees/hour
//-----------------------------------------------------------------------
#include<stdio.h>
int main(){
int hour, amount;
printf("Enter number of duty hours\n");
scanf("%d", &hour);
if (hour >= 1 && hour <= 8)
amount = 100;
else if (hour >= 9 && hour <= 12)
amount = 100 + (hour - 8)*20;
else if (hour >= 13 && hour <= 16)
amount = 180 + (hour - 12)*40;
else if (hour >= 17 && hour <= 20)
amount = 340 + (hour - 16)*60;
else if (hour >= 21 && hour <= 24)
amount = 580 + (hour - 20)*80;
printf("Amount incurred by worker : %d", amount);
return 0;
}