Problem: Ramesh's basic salary is input through 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.
Formulae used: Gross salary = Basic salary + Dearness allowance + House rent allowance
C program:
// Program by Shyam Kanth#include<stdio.h>int main(){int bs,da,hra,gs;printf("Enter basic salary : ");scanf("%d",&bs);da = bs*0.4;hra = bs*0.2;gs = bs+da+hra;printf("Gross salary of ramesh is : %d.",gs);return 0;}
Codes used:
- #include<stdio.h> : Header file for input-output
- int : Data type
- bs,da,hra,gs : Variable used
- printf : Function for displaying message
- scanf : Function for taking input
Do Comment, If any doubt.
Know about me : Shyam Kanth
No comments:
Post a Comment