13.2k views
5 votes
Complete the following code to display "teen" if a person is a teenager based on their age.

System.out.println("teen");

1 Answer

2 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

Java programming language will be used to display "teen" if a person is a teenager based on their age.

public class HelloWorld{

public static void main(String []args){

int age;

age =13;

if (age>12 && age<20)// if age is between 12 and 20 such as 13,14,15,16,17,18,19- then this program will print "Teen"

{

System.out.println("Teen");

}

}

}

User Gotye
by
4.8k points