Write a program using function with Return Type and with Parameter to calculate overtime
pay of 10 employees. Overtime is paid at the rate of Rs. 50.00 per hour for every hour worked
above 40 hours. Assume that employees do not work for fractional part of an hour.
Answers
Answer:
#include<stdio.h>
#include<conio.h>
int main()
{
int count = 1, working_hours, over_time;
float over_time_pay;
while(count<=10)
{
printf("Enter the working hours of employee no %d: ", count);
scanf("%d", &working_hours);
if(working_hours>40)
{
over_time = working_hours - 40;
over_time_pay = over_time * 12.00;
printf("Employee No %d overtime pay is %.2f\n", count, over_time_pay);
}
else
printf("You have to work for more than 40 hours to get over time pay\n");
count++;
}
}
Output:
Enter the working hours of employee no 1: 30
You have to work for more than 40 hours to get over time pay
Enter the working hours of employee no 2: 43
Employee No 2 overtime pay is 36.00
Enter the working hours of employee no 3: 23
You have to work for more than 40 hours to get over time pay
Enter the working hours of employee no 4: 55
Employee No 4 overtime pay is 180.00
Enter the working hours of employee no 5: 44
Employee No 5 overtime pay is 48.00
Enter the working hours of employee no 6: 32
You have to work for more than 40 hours to get over time pay
Enter the working hours of employee no 7: 42
Employee No 7 overtime pay is 24.00
Enter the working hours of employee no 8: 69
Employee No 8 overtime pay is 348.00
Enter the working hours of employee no 9: 32
You have to work for more than 40 hours to get over time pay
Enter the working hours of employee no 10: 4
You have to work for more than 40 hours to get over time pay