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.

#include<stdio.h>
main()
{
int hours, employees;

float overtime_rate, overtime_pay, overtime, break_time;


employees=1;

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);

break;


}

employees++;

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

}

}

}




The file can be found at:
Download File


No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin