Write a C program to input basic salary of an employee and calculate gross salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%
Example
Input
Input basic salary of an employee: 22000
Output
Gross salary = 44000
Logic to find gross salary of an employee
Step by step descriptive logic to find gross salary of an employee.
- Input basic salary of employee. Store it in some variable say
basic_salary
. - If
basic_salary <= 10000
then,hra = basic_salary * 0.8
andda = basic_salary * 0.2
. - Similarly check basic salary and compute hra and da accordingly.
- Calculate final gross salary using formula
gross_salary = basic_salary + da + hra
.
/**
* C program to calculate gross salary of an employee
*/
#include <stdio.h>
int main()
{
float basic, gross, da, hra;
/* Input basic salary of employee */
printf("Enter basic salary of an employee: ");
scanf("%f", &basic);
/* Calculate D.A and H.R.A according to specified conditions */
if(basic <= 10000)
{
da = basic * 0.8;
hra = basic * 0.2;
}
else if(basic <= 20000)
{
da = basic * 0.9;
hra = basic * 0.25;
}
else
{
da = basic * 0.95;
hra = basic * 0.3;
}
/* Calculate gross salary */
gross = basic + hra + da;
printf("GROSS SALARY OF EMPLOYEE = %.2f", gross);
return 0;
}
/*
Output :
Enter basic salary of an employee: 22000
GROSS SALARY OF EMPLOYEE = 49500.00
*/
Witth havin so much content do you ever run into
any problems of plagorism or copyright infringement?
My blog hass a lot of unuque content I’ve either
created myself or outsourced but it looks like a
lot of it iis popping it uup all over the internet wihout
my agreement. Do you know any methods to help prevent content from being ripped off?
I’d genuinely appreciate it. http://boyarka-inform.com/
I tend not to create many remarks, however i did
some searching and wound up here C program to entter basic salary and calculate gross salary of an employee – Learn to Code and Code to Learn. And I do have a couple of questions for you if you tend not tto mind.
Is it simply me or does it give thee impression like some of the comments come across
lile thhey are left by brain dead people? 😛 And, if you are posting
at additional places, I would like to follow everything fresh you have to post.
Would you list of every onee of your communal pages like your twitter
feed, Facenook page or linkedin profile? http://boyarka-inform.com/