package tutorial; import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Enter your age:");
Scanner sc = new Scanner(System.in);
int age = sc.nextInt();
if(age > 13 ) {
System.out.println(" you are a teenager");
}
if else(age >18) {
System.out.println("You are adult! you can drive");
}
}
else {
System.out.println("you cant drive");
}
If enter age as " 21" .It just prints the first if else statement .I just want solution and explanation
Aucun commentaire:
Enregistrer un commentaire