Harish's basic salary is input through the keyboard. His dearness allowance is 40%, of basic salary, and house rent allowance is 20% of basic salary, write a program to calculate his gross salary.
#include<stdio.h>
#include<conio.h>
int main()
{
float bp,da,hra,grpay;
// clrscr();
printf("Enter the Basic Pay of Harish:");
scanf("%f",&bp);
da=0.4*bp;
hra=0.2*bp;
grpay=bp+da+hra;
printf("\nBasic Pay of Harish= %.2f",bp);
printf("\nDearness Allowance= %.2f",da);
printf("\nHouse Rent Allowance= %.2f",hra);
printf("\nGross Pay of Ramesh is= %.2f",grpay);
printf("\n\n\n\nPress any key to exit.....");
getch();
}
Output:-
#include<stdio.h>
#include<conio.h>
int main()
{
float bp,da,hra,grpay;
// clrscr();
printf("Enter the Basic Pay of Harish:");
scanf("%f",&bp);
da=0.4*bp;
hra=0.2*bp;
grpay=bp+da+hra;
printf("\nBasic Pay of Harish= %.2f",bp);
printf("\nDearness Allowance= %.2f",da);
printf("\nHouse Rent Allowance= %.2f",hra);
printf("\nGross Pay of Ramesh is= %.2f",grpay);
printf("\n\n\n\nPress any key to exit.....");
getch();
}
Output:-
No comments:
Post a Comment