Saturday, January 30, 2010

CHAP 3[B](a) Calculating overtime pay

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.

void main()
{
float d,p;
int i=1;
while(i<=10)
{
printf("\nInput the total hours worked for the week");
scanf("%f",&d);

if(d<=40)
{
printf("\nNo overtime pay");
break;
}

else
p=12.00*(d-40);

printf("\nThe overtime pay is Rs. %f",p);
i++;
}
}

2 comments: