Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Monday, January 4, 2010

Write a program in 'C' to calculate house rent allowance (hra), Dearness allowance (da) and the gross & Net salary. (Using if.........else statement.)

Q.1) In a company the employee are paid as follows:-
If basic pay (bp) is less than Rs. 2000/- then the house rent allowance (hra) is 10% of basic pay and dearness allowance (da) is 90% of basic pay.
If basic pay is equal or more than Rs. 2000/- then the house rent allowance is Rs. 500/- and dearness allowance is 98% of basic pay.
Gross salary (gs) = bp + hra + da

Write a program in 'C' to enter the basic pay and to find and print the hra, da and the gross salary.




#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float bp, hra, da, gs;
printf(" \n Enter the basic pay \n");
scanf("%f", &bp);
if (bp < 2000)
{
hra = bp * 10/100;
da = bp * 90/100;
}
else
{
hra = 500.0;
da = bp * 98/100;
}
gs = bp + hra + da;
printf("The hra is Rs. %f \n", hra);
printf("The da is Rs. %f \n", da);
printf("The gross salary is %f \n", gs);
return(0);
}

For eg :-

Output :-
Enter the basic pay
1000
The hra is Rs. 100.000000
The da is Rs. 900.000000
The gross salary is Rs. 2000.000000

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP