import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.print("Enter your name: ");
Scanner in = new Scanner(System.in);
String name = in.next();
System.out.print("Enter your year of birth: ");
int year = in.nextInt();
int decades = (2021 - year) / 10;
System.out.printf("Hello %s, you have lived for %d decade(s)", name, decades);
in.close();
}
}
Comments
Leave a comment