179k views
1 vote
Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00

per hour for every hour worked above 40 hours. Assume that employees do not work for fractional
part of an hour.

1 Answer

5 votes

Answer:

Here is the code.

Step-by-step explanation:

#include<stdio.h>

int main()

{

int i, time_worked, over_time, overtime_pay = 0;

for (i = 1; i <= 10; i++)

{

printf("\\Enter the time employee worked in hr ");

scanf("%d", &time_worked);

if (time_worked>40)

{

over_time = time_worked - 40;

overtime_pay = overtime_pay + (12 * over_time);

}

}

printf("\\Total Overtime Pay Of 10 Employees Is %d", overtime_pay);

return 0;

}

Output :

Enter the time employee worked in hr 42

Enter the time employee worked in hr 45

Enter the time employee worked in hr 42

Enter the time employee worked in hr 41

Enter the time employee worked in hr 50

Enter the time employee worked in hr 51

Enter the time employee worked in hr 52

Enter the time employee worked in hr 53

Enter the time employee worked in hr 54

Enter the time employee worked in hr 55

Total Overtime Pay Of 10 Employees Is 1020.

User Bozhena
by
5.7k points