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

Anonymous said…
can anyone tell me the use of break statement plss.
sasitamil said…

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
lavanya said…
Nice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful.

Java training in Chennai

Java training in Bangalore

Java training in Hyderabad

Java Training in Coimbatore

Java Online Training

shiny said…
Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.


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
deiva said…
Nice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated posts…
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


Shivam said…
Such a nice code . I am feeling great to read this and use this code c++ lan. to java😍💦
360DigiTMG said…
It was a wonderful chance to visit this kind of site and I am happy to know. Thank you so much for giving us a chance to have this opportunity..
data scientist training in hyderabad
Unknown said…
The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention. data analytics course in surat
Ramesh Sampangi said…
Informative blog and knowledgeable content. If you want to become a data science training then follow the below link.
AI Patasala Data Science Course in Hyderabad

Popular posts from this blog

C Program - Calculation of Area and Circumference of a Circle using Pointers

Matchstick Game using C Programming

C Program to Calculate Factorial of a number using Recursion