Net Salary using Structure coderinme

Net Salary using Structure coderinme

Net Salary using Structure coderinme
Let us now write C statements that will read four inputs interactively. These inputs are:
a name as a string, a pay rate, work hour as decimal numbers, and tax deduction as integer number.
We have to calculate a net salary by multiplying the pay rate and the work hour and subtract from it tax deduction on whole salary. Assume that the salary is a decimal number.
The program should be able to produce the following output, for example, if the values of the name, pay rate, work hour, and tax deduction are “Suhail Ahmad Khan”, 12.50, 45.50, and 4% respectively, then the output is: Name: Suhail Ahmad Khan Pay rate: Rs 12.50 Work hour: 45.50 hours Tax Deduction: 4% Net Salary: Rs 546.00

#include<stdio.h>
struct person
{
char name[20];
float work_hour, pay_rate, tax;
}sal;
int main()
{
float salary;
printf("\nPlease give the:\nName Work_hour Pay-rate Tax(Percent)\n");
scanf("%s %f %f %f",&sal.name,&sal.work_hour,&sal.pay_rate,&sal.tax);
salary=(sal.work_hour*sal.pay_rate);
salary=salary-(sal.tax/100)*salary;
printf("\n\nName: %s\nPay rate:%.2f\nWork hour:%.2f\nTax Deduction:%.2f%c \nNet salary:%.2f\n",sal.name,sal.pay_rate,sal.work_hour,sal.tax,'%',salary);
getch();
return 0;
}

For more programs in C, visit our C Coder Archives

Net Salary using Structure 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.