This article is from solution of Let Us C by Yashwant Kanetkar. I also posted many another articles regarding solutions of Let Us C. If you have any problem regarding solution then give comment, I will surely reply your question.
Q. Write a program to calculate over time 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 wprk for fractional part of an hour.
Ans.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i, time_worked, over_time, overtime_pay=0;
for(i=1;i<=10;i++)
{
printf("\nenter 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("\nTotal Overtime Pay Of 10 Employees Is %d",overtime_pay);
getch();
}