HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C Program to Enter Basic Salary and Calculate Gross Salary of an Employee Using If Else ?


Q:- Write a  C Program to Enter Basic Salary and Calculate Gross Salary of an
       Employee Using If Else ?
      Input
        #include<stdio.h>
        #include<conio.h>
        int main()
   {
float basic,gross,da,hra;
printf(“Enter Basic Salary of an Employee =”);
scanf(“%f”,&basic);
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;
}
gross = basic + hra + da;
printf(“Gross Salary of an Employee =%.2f\n”,gross);
getch();
    }


Output

Enter Basic Salary of an Employee = 22000
Gross Salary of an Employee = 49500.00

Comments