Sunday, July 23, 2006

Calculation of Overtime pay (using while loop)

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.

int hours, employees;

float overtime_rate, overtime_pay, overtime, break_time;


while (employees<=10)

printf ("\nEnter the number of Hours you have worked: " );

scanf ("%d", &hours);

while (hours>40)


printf ("\nEnter the fractional part of overtime you haven't worked (in hours):");
/*This will take care of the break. The fractional part for which the employee
did not work!!! */

scanf ("%f", &break_time);

overtime = hours - 40 - break_time;

overtime_rate = 12.00;

overtime_pay = overtime_rate * overtime;

printf ("Your overtime pay is:%f", overtime_pay);




if (hours<40)
printf("You have not worked hard enough. \nYou won't get any overtime! ");




The file can be found at:
Download File


sanjay varma said...

Appreciation for nice Updates, I found something new and folks can get useful info about BEST ONLINE TRAINING

prathap kumar said...

I have read your blog its very attractive and impressive. I like it your blog.

Dot Net Training in Chennai | Online Dot Net Training

Online Dot Net Training | Online LINQ Training

1croreprojects said...

Thanks for sharing this valuable information.
java projects in chennai
dotnet projects in chennai
mba projects in chennai
be projects in chennai
ns2 projects in chennai