/* Calculate Da,Ta,Hra Using If Else */
/*
****If Basic >= 7000 Then Da 50% Hra 30% And Ta 20%****
****If Basic >= 5000 And Basic < 7000 Then Da 30% Hra 20% And Ta 20%****
*/
/* Suchetan Dey */
#include<stdio.h>
#include<conio.h>
void main()
{
float basic,da,ta,hra,gross;
printf("Enter Your Basic Salary ");
scanf("%f",&basic);
if(basic>=7000)
{
da=basic*.5;
hra=basic*.3;
ta=basic*.2;
gross=basic+da+ta+hra;
printf("Gross=%.2f",gross);
}
else if(basic>=5000 && basic<7000)
{
da=basic*.3;
hra=basic*.2;
ta=basic*.2;
gross=basic+da+ta+hra;
printf("Gross=%.2f",gross);
}
else
{
printf("Please Enter Your Basic Salary Above Or Equal To 5000");
}
getch();
}
The Output is :-
/*
****If Basic >= 7000 Then Da 50% Hra 30% And Ta 20%****
****If Basic >= 5000 And Basic < 7000 Then Da 30% Hra 20% And Ta 20%****
*/
/* Suchetan Dey */
#include<stdio.h>
#include<conio.h>
void main()
{
float basic,da,ta,hra,gross;
printf("Enter Your Basic Salary ");
scanf("%f",&basic);
if(basic>=7000)
{
da=basic*.5;
hra=basic*.3;
ta=basic*.2;
gross=basic+da+ta+hra;
printf("Gross=%.2f",gross);
}
else if(basic>=5000 && basic<7000)
{
da=basic*.3;
hra=basic*.2;
ta=basic*.2;
gross=basic+da+ta+hra;
printf("Gross=%.2f",gross);
}
else
{
printf("Please Enter Your Basic Salary Above Or Equal To 5000");
}
getch();
}
The Output is :-
No comments:
Post a Comment