#include <stdio.h>
int main()
{
float overtime_week_day=14,overtime_weekend=5,total_over _time;
float overtime_weekendpay,overtime_week_daypay,standard_ pay, normal_pay;
float over_pay, new_pay1, new_pay2;
float tax1, tax2, tax3,tax;
standard_pay=19.73*35;
total_over_time=overtime_weekend+overtime_week_day ;
overtime_weekendpay=overtime_weekend*(1.25*19.73);
overtime_week_daypay=overtime_week_day*(1.5*19.73) ;
over_pay=overtime_weekendpay+overtime_week_daypay;
normal_pay=standard_pay+over_pay;
{
if(normal_pay>=200)
{
tax1=(30/100)*normal_pay;
new_pay1=normal_pay-tax1;
}
else if(new_pay1>=300)
{
tax2=(40/100)*normal_pay;
new_pay2=new_pay1-tax2;
}
else if(new_pay2>=0)
{
tax3=(50/100)*new_pay2;
}
tax=tax1+tax2+tax3;
}
printf("\nThe normal week pay is %f, the overtime pay is %f, the tax deduction is %2f\n",normal_pay,over_pay,tax);
return 0;
}
Output:
The normal week pay is 1228.192383, the overtime pay is 537.642456, the tax deduction is -214748352.0000........
i dunno wots wrong with my program i fink its the if else can some help me so that it returns the correct value for "tax deduction" safe...