(a) 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.


Let Us C by Yashwant Kanetkar

 
Solution By Muhammad Kaleem UIlah



                                                                  Exercise Questions 
[H] Write C programs for the following:
(a) 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.

Solution : 
#include<stdio.h>
#include<stdlib.h>
int main()
{

    float bs,da,hr,ts;

    printf("\n\t\t Do You Want to Calculate Your Salary ? ");         
   printf("\n\t\t*******************************************");

    printf("\n\t\t Enter Your Basic Salary = ");

    scanf("%f",&bs);

    da=(40.0/100)*bs;

    hr=(20.0/100)*bs;

    ts=da+hr+bs;

    printf("\n\t\t Your Total Salary is = %f",ts);

    return 0;

}

Comments

Post a Comment

Popular posts from this blog

EXERCISE 01 Complete Solved LET US C by Yashwant Kanetkar

(k) A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.

(g) If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)