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.
#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
Comments
It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training
Selenium training in bangalore
Data Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune
Data science course in bangalore
Java training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
java training in chennai
java training in tambaram
aws training in chennai
aws training in tambaram
python training in chennai
python training in tambaram
selenium training in chennai
selenium training in tambaram
hadoop training in chennai
hadoop training in annanagar
salesforce training in chennai
salesforce training in annanagar
c and c plus plus course in chennai
c and c plus plus course in annanagar
machine learning training in chennai
machine learning training in annanagar
sap training in chennai
sap training in omr
azure training in chennai
azure training in omr
cyber security course in chennai
cyber security course in omr
ethical hacking course in chennai
ethical hacking course in omr
data scientist training in hyderabad
AI Patasala Data Science Course in Hyderabad