Sunday 8 July 2012

Conditional statement003

The current year and the year in which the employee joined the organization are entered through the keyboard. If the number of years for which the employee served the organization is greeter than three then a bonus of Rs. 2500/- is given to the employee. If the years of service is not greeter than three, then the program should not do any thing. 


#include <stdio.h>
#include <conio.h>
void main ( )
{    
        int         bonus, cy, yoj, yr_of_ser;
        clrscr ( );
                        
        printf ("\n\n\n\t\t Enter current year........:"); scanf ("%d",&cy);
        printf ("\n\n\t\t Enter year of joining.....:"); scanf ("%d",&yoj);
                  
        yr_of_ser = cy - yoj;
        if ( yr_of_ser > 3 )
        {                           
                  bonus = 2500;
                  printf ("\n\n\n\t\t Bonus.......: Rs.%d",bonus);
        }
        getch ( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...