// this is my code
import java.util.*;
public class conditional {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int age = sc.nextInt();
if(age>=18){
System.out.println("you are eligible to vote,drive,drink");
}
if(age>=13 && age<18){
System.out.println("you are teenager");
}
else{
System.out.println("you are not an adult");
}
}
}
this is the error i am getting
20
you are eligible to vote,drive,drink
you are not an adult
when i entered age 17 it was showing you are an teenager
when i entered age 12 it showed you are not an adult
when i entered age 18 or more tha 18 it is showing both you are eligible to vote,drive,drink
you are not an adult
New contributor
Saujanya Rao is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1