package algorithmsample1;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample1 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int age = 0;
System.out.println("Please enter your age!");
try {
age = scan.nextInt();
if (age >= 18) {
System.out.println("You are legally an adult!");
} else {
System.out.println("You are not legally an adult!");
}
} catch (Exception e) {
System.out.println("Please enter a valid value!");
}
}
}
Comments
Post a Comment