Write basic C program to calculate gross salary
Write a C Program for the following :-
Ramesh’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.
Answer:
/* To Calculate the gross salary of Ramesh */
#include<stdio.h>
#include<conio.h>
main()
{
float bp,da, hra, grpay;
clrscr(); /* TO Clear Screen*/
printf(“\n Enter the Basic Pay of Ramesh:”);
scanf(“%f”,&bp);
da=0.4*bp;
hra=0.2*bp;
grpay=bp+da+hra; /* Gross pay = Sum of basic+All allowance */
printf(“\n Basic Pay of Ramesh=%f”, bp);
printf(“\n Dearness Allowance of Ramesh=%f”, da);
printf(“\n House Rent of Ramesh=%f”, hra);
printf(“\n Gross Pay of Ramesh=%f”, grpay);
Printf(“/n/n/n/n/n Press any key to exit….”);
getch(); /* Readsd a character from keyboard */
}
Run this program and tell us your output.
It’s amazing for me to have a website, which is useful designed for my knowledge.
thanks admin