Q: 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.

#include<stdio.h>
int main()
{
float bs, da, hr, gs;      /*bs=basic salary,da=dearness allow,hr=house rent, gs=gross salary*/
    printf("Enter Basic Salary: ");   
    scanf("%f",&bs);

    da = 0.4 * bs;
    hr = 0.2 * bs;
gs= bs + da + hr;

        printf("\nBasic Salary: %f\n",  bs);
    printf("Dearness Allowance: %f\n", da);
    printf("House Rent: %f\n", hr);
    printf("\n\nGross Salary: %f\n",gs);

    return 0;
}

-----------------------------------------
Output:

Enter Basic Salary: 1000

Basic Salary: 1000.000000
Dearness Allowance: 400.000000
House Rent: 200.000000


Gross Salary: 1600.000000

Comments

Popular posts from this blog

Q: Consider a currency system in which there are note of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. if a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs N.

Q: Two number are input through the keyboard into two two locations C and D. write a program to interchange the contents of C and D.