Previous | Home | Next |
In this program we are using #include<stdio.h> and #include<conio.h> header files. main() is a predefined function here. bs, gs, da, hra are the variables of float type. printf() is used as a output function and scanf() is used as input function. if is used as a conditional statement. if the condition is true then if condition will execute and if condition is false then else condition will execute.
/** Calculation of Gross Salary **/ #include <stdio.h> #include <conio.h> main() { float bs, gs, da, hra; printf ("Enter basic salary"); scanf ("%f",&bs); if (bs<1500) { hra=bs*10/100; da=bs*90/100; } else { hra=500; da=bs*98/100; } gs=bs+ hra+ da; printf ("gross salary=Rs. %f ",gs); }
Enter basic salary
2000
gross salary=Rs. 4460.0
Previous | Home | Next |