CALCULATE THE BONUS OF EMPLOYEE A/C TO BASIC SALARY
#include<stdio.h>
#include<conio.h>
struct employee
{
char emp_name[20],emp_grad[2];
int emp_bs,emp_code;
float emp_bonus;
};
void main()
{
struct employee emp;
char g;
int hitesh=0;
clrscr();
printf("Enter employee name = ");
gets(emp.emp_name);
printf("Enter employee code = ");
scanf("%d",&emp.emp_code);
printf("Enter Basic salary = ");
scanf("%d",&emp.emp_bs);
printf("Enter Grad of employee = ");
g=getch();
printf("%c",g);
if(g=='a'|| g=='A')
{
emp.emp_bonus=emp.emp_bs*0.5;
printf("\n\nBONUS %f = ",emp.emp_bonus);
hitesh=1;
}
if(g=='b'|| g=='B')
{
emp.emp_bonus=emp.emp_bs*0.1;
printf("\n\nBONUS %f = ",emp.emp_bonus);
hitesh=1;
}
if(g=='c'|| g=='C')
{
emp.emp_bonus=emp.emp_bs*0.02;
printf("\n\nBONUS %f = ",emp.emp_bonus);
hitesh=1;
}
if(hitesh==0)
{
printf("\n\nNo bonus");
}
getch();
}
OUTPUT
No comments:
Post a Comment