Translate

Showing posts with label nested if. Show all posts
Showing posts with label nested if. Show all posts

Friday, May 1, 2020

Program How to calculate Gross salary of employee

Calculate Gross Salary

Write a program to calculate gross salary of employee, basic salary is enter by the user, da is calculated on the basic of the following criteria.


bsal da
below 5000 10% of bsal
5000-10000 15% of bsal
10000-20000 20% of bsal
20000-above 40% of bsal

#include<stdio.h>
#include<conio.h>
void main()
{
    int bsal, da, gsal;
    printf("enter bsal = ");
    scanf("%d",& bsal);
    if(bsal<5000)
       da=(bsal*0.10);
    
    if((bsal>=5000)&&(bsal<10000))
       da=(bsal*0.15);
       
    if((bsal>=10000)&&(bsal<20000))
       da=(bsal*0.20);
       
    if(bsal>=20000)
       da=(bsal*0.40);
       
       gsal=bsal+da;
       printf("Gross salary of employee is= %d",gsal);
       getch();
       
}
Output:




C program to make a calculator using the switch statement.

/*perform arithmetic calculation on integers in C language*/ #include<stdio.h> #include<conio.h> void main() {     char op;     ...