1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nignag [31]
3 years ago
9

Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only

the expression. Sample output with input: 17 18 or less
Computers and Technology
2 answers:
Tcecarenko [31]3 years ago
7 0

Answer:

user_age = int(input())

if user_age <= 18:

  print('18 or less')

else:

  print('Over 18')

Explanation:

#define user_age with: integer (input(' #from user')

user_age = int(input())

#"if" statement: user_age is less than or equal to 18 than ///

if user_age <= 18:

#Print ('Enter desired output here')

  print('18 or less')

#"else" statement: If above is not true then ///

else:

#Print ('Enter desired output here')

  print('Over 18')

lana [24]3 years ago
6 0

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");

       }

   }

}

You might be interested in
"a router interface has been assigned an ip address of 172.16.192.166 with a mask of 255.255.255.252. to which subnet does the i
baherus [9]
An interface with an address of 172.16.192.166/30 has only 2 hosts per subnet. 172.16.192.166 and 172.168.192.169 are those hosts.
This configuration is usually only assigned to serial links with one source and one destination address like a T1/3.
3 0
4 years ago
Pls help me computer science discoveries
lara31 [8.8K]

Answer:

jdinwoahdjsioadjsakodsiaohdeioajfnsohfujkdshksyfneowjdfikdjiadjsadhnsuidghaiudbnha

Explanation:

3 0
3 years ago
Contagem progressiva e regressiva usando estrutura condicional enquanto no visualg
lana [24]
Girls are so evil nowadays
6 0
3 years ago
A program that will read each player’s name and golf score as keyboard input,
PtichkaEL [24]
Use for loop and question inside it
7 0
3 years ago
Which feature does the web designer fail to apply in this layout for a web page? A. harmony
iogann1982 [59]
The answer is D.balance
3 0
3 years ago
Read 2 more answers
Other questions:
  • Which is NOT a way the network operating sys-
    6·1 answer
  • which resource do programmers sometimes have to refer to and use during planning the logical steps of the solution
    15·2 answers
  • If you want to conserve ink or toner, you can instruct PowerPoint to print ____ documents.
    10·1 answer
  • Atari licensed a game from taito that became a smash-hit and helped sell the vcs/2600. what is the name of that game?
    14·2 answers
  • The CPU (central processing unit), also known as a processor, is considered the brain of the computer. What is the CPU’s functio
    6·1 answer
  • What type of data is not defined and does not follow a specified format and is typically free-form text such as emails, Twitter
    13·1 answer
  • A presentation is widely used to present ______ and ______ effectively​
    12·1 answer
  • Which of the following was (and still is) used by computer programmers as a first test program?
    13·2 answers
  • Difference between the four generations of computers in a tabular form​
    8·1 answer
  • with a ____ the traffic of a given enterprise or group passes transparently through an internet in a way that effectively segreg
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!