Monday 14 January 2013

Let Us C Chapter 3 problem No: B-a


//Program to calculate overtime paid to 10 employess

#include<iostream>

using namespace std;

int main(void)
{
    int i,j,h,s;

    for(i=0;i<10;i++)
    {

    cout<<"Enter the total working hours of employee "<<i+1<<":  ";
    cin>>h;

    if(h>40)
    {
        s= (h-40)*12;
        cout<<"Employee "<<i+1<<" worked overtime for "<<(h-40)<<" hours\n";
        cout<<"And hence will get additional "<<s<<" $\n";
    }
    else
    {
        cout<<"Employee "<<i+1<<" did no overtime hence will get 0$ as additional salary\n";
    }
    cout<<endl;
    }
}

No comments:

Post a Comment

Comments please: