+ 1
Why it is showing 'No Output'. Is there any problem in my code
2 Answers
0
import java.util.Scanner;
class MyClass {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
double income = sc.nextDouble();
if(income<2.5){
System.out.println("You Doesn't have to pay income tax");
}else if(income>2.5 && income<5.0){
System.out.println("You have to pay 5% tax");
}else if(income>5.0 && income<10.0){
System.out.println("You have to pay 20% tax");
}else if(income>10.0){
System.out.println("You have to pay 30% tax");
}else{
System.out.println("Noting to Show");
}
}
}
bro it is showing answer if try it
but it is not showing answer when we enter the inputs 2.5, 5.0, 10.0. because you haven't write any command related to them
you should try this code
import java.util.Scanner;
class MyClass {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
double income = sc.nextDouble();
if(income<2.5){
System.out.println("You Doesn't have to pay income tax");
}else if(income>=2.5 && income<5.0){
System.out.println("You have to pay 5% tax");
}else if(income>=5.0 && income<10.0){
System.out.println("You have to pay 20% tax");
}else if(income>=10.0){
System.out.println("You have to pay 30% tax");
}else{
System.out.println("Noting to Show");
}
}
}