Gross Salary from Basic Salary coderinme

Gross Salary from Basic Salary

To compute Gross Salary if Basic Salary is given along with other allowances like
DA: Dear Allowance = 70% of Basic Salary
TA: Travel Allowance = 15% of Basic Salary
HRA: House Rent Allowance = 20% of Basic Salary
We just have to add up them all using the following formula:
Gross Salary = BS + DA + TA + HRA
Now let’s code it in C

int main() 
float gross_salary, base_salary,dearness_allowance,travel_allowance,house_rent_allowance; 
printf("Please Enter the Gross Salary: "); 
dearness_allowance = ( 70.0 / 100 ) * base_salary; 
printf("Salary Calculator:\n"); 
printf("The Base Salary: %10.2f\n",base_salary); 
printf("The Dearness Allowance: %10.2f\n",dearness_allowance); 
travel_allowance = ( 15.0 / 100 ) * base_salary; 
printf("The Travelling Allowance: %10.2f\n",travel_allowance); 
house_rent_allowance = ( 20.0 / 100 ) * base_salary; 
printf("The House Rent Allowance: %10.2f\n",house_rent_allowance); 
gross_salary = base_salary + dearness_allowance + travel_allowance + house_rent_allowance; 
printf(" + ________\n"); 
printf("The Gross salary: %10.2f\n",gross_salary); 
return 0; 

For more programs in C, visit our C Coder Archives
Gross Salary from Basic Salary coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.