Wednesday, April 15, 2009

Calculate gross salary

/*If his basic salary is less than Rs. 1500, then HRA = 10% of basic
salary and DA = 90% of basic salary. If his salary is either equal to
or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic
salary. If the employee's salary is input through the keyboard write
a program to find his gross salary.*/

Solution Code:-
=========


#include <stdio.h>
int main(void)
{
int bs;
float hra,da,gross;
printf("Enter Basic Salary : ");
scanf("%d",&bs);
if ( bs < 1500 )
{
hra = bs * 10 / 100;
da = bs * 90 /100;

}

else
{
hra = 500 ;
da = bs * 98 /100;
}

gross = hra + da + bs ;
printf("\n Your gross salary is %f",gross);
return 0;
}

No comments: