Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- float total_salary(int basic){
- float Total, HRA, DA, Tax;
- // HRA and DA Calculation
- if(basic <= 1000){
- HRA = (basic / 100) * 20;
- DA = (basic / 100) * 80;
- }else if(basic > 1000 && basic <= 20000){
- HRA = (basic / 100) * 25;
- DA = (basic / 100) * 90;
- }else if(basic >= 20001){
- HRA = (basic / 100) * 30;
- DA = (basic / 100) * 95;
- }
- Total = HRA + DA;
- // Tax Deduction
- // Yearly 10%, So Monthly = 10 / 12
- Tax = ((Total / 100) * 10) / 12;
- Total = Total - Tax;
- return Total;
- }
- int main(){
- int salary;
- float gross_salary;
- printf("Basic Salary: ");
- scanf("%d", &salary);
- gross_salary = total_salary(salary);
- printf("Gross Salary: %.2f\n\n", gross_salary);
- return 0;
- }
Add Comment
Please, Sign In to add comment