w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I am writing a programm in which user enter a amount and programm display tax due calculatig percntage of tax as per thier income group?

You need && instead of || in if conditions.

In your code for inm = 3000 second if-case-condition pass because you use || condition that evaluates 52.... (check what is happening, and what you need both)

In your, code the third case is in else part of second if. You have nested ifs, whereas you need sequential ifs, remove else.

if(inm<750){
    printf("tax due :%f",inm*1/100);
}
if(inm>=750 && inm<=2250){
    printf("tax due :%f",inm=7.50+((inm-750)*2/100));
}
if(inm>=2251 && inm<=3750){
    printf("tax due :%f",inm=37.50+((inm-2250)*3/100));
}

codepad

Addtionally, indent your code correctly.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.