Respuesta :
Answer:
if (user_age<=18){
System.out.println("18 or less");
}
Explanation:
The above expression in Java will print "18 or less" if the input is less than 18.
Consider a complete java program that request a user to input his/her age below and prints "18 or Less" if the user age is less or equal to 18.
import java.util.Scanner;
public class num2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("enter age:");
int user_age =in.nextInt();
if (user_age<=18){
System.out.println("18 or less");
}
else
{
System.out.println("greater than 18");
}
}
}
The program prompts users for their age and displays an expression if they are 18 or below. The program written in python 3 goes thus :
your_age = int(input("Enter your age : "))
#prompts user to enter their age value
if your_age <= 18 :
#checks if the imputed age value is less than or equal to 18
print('print 18 or less ')
#display the expression for users whose age is less than 18
A sample run of the program is attached.
Learn more : https://brainly.com/question/20533392
