Computer Science, asked by ranjitsinghji26, 2 months ago

write a program that reads the user's age and then print "you are a child "if he say age is<18,"your are adult ",if 18 <=age<=65

Answers

Answered by kamalrajatjoshi94
1

Answer:

import java.util.*;

public class Age

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int age;

System.out.println("Enter the age");

age=in.nextInt();

if(age<18)

{

System.out.println("You are a child");

else

System.out.println("You are an adult");

}

}

}

Class compiled no syntax errors

Output

Enter the age

46(I wrote this you can write anything of your choice)

You are an adult

Similar questions