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
Vadim26 [7]
3 years ago
12

Write a program that checks whether a positive number given by an input from the user is greater than 5 and less than 20 with ja

va in eclipse. Output the result.
Computers and Technology
1 answer:
Alona [7]3 years ago
5 0

Answer:

Program written in Java is as follows

See comments for explanations

import java.util.Scanner;

public class CheckRange {

public static void main (String [] args)

{

// This line allows the program accept user input

Scanner input = new Scanner(System.in);

//This line declares variable for user input

int num;

//This line prompts user for input

System.out.print("Number: ");

//This line gets user input

num = input.nextInt();

/* The following if statement checks if the user input is greater than 5 and less than 20 */

if (num > 5 && num <= 20)

{

/* This line is executed if the above condition is true */

System.out.print(num+" is greater than 5 and less than 20");

}

else

{

/*If the condition is not true, this line is executed*/

System.out.print(num+" is not within specified range");

}

// The if condition ends here

}

}

You might be interested in
Looking at your Personal Fact Sheet, do you see any areas that may need improvement? In which areas do you have the most room fo
Andrej [43]
In the Church and in the classroom.
4 0
3 years ago
Read 2 more answers
The default color scheme is called ____.
notsponge [240]
What program is this regarding?

If it's a Microsoft Office product, the default colour scheme is "office"
5 0
3 years ago
why is it that everytime i ask a question (with brainly plus) it says there arnt any matches for your search. are the servers do
fiasKO [112]
That happens to me to
6 0
2 years ago
The main reason for using a comment in your HTML code is to
zvonat [6]

Answer:

D, document and explain parts of code

Explanation:

Mark me brainliest :)

8 0
2 years ago
T F In a function prototype, the names of the parameter variables may be left out.
prisoha [69]

Answer:

True.

Explanation:

In a function prototype, the names of the parameter variables may be left out.

8 0
3 years ago
Other questions:
  • The code selection above is taken from the Color Sleuth activity you just completed. This selection would count as an abstractio
    12·1 answer
  • Describe in 2–3 sentences how you would use the autosum shortcut.
    9·2 answers
  • Cyberterrorism is the use of terrorism to attack (Points : 1) public libraries. computer based networks. government spy networks
    15·1 answer
  • The person in charge of recording the sound should always
    15·1 answer
  • In Modern operating system, the __ feature has dramatically improved user productivity.
    11·1 answer
  • In the Advent of computer technologies and it's applications, to what extent these technologies have influenced the world.
    11·1 answer
  • Consider the following code: def tryIt(b): for i in range(len(b)): b[i] = b[i] + 100 #***********MAIN************ x = [] x = [56
    8·1 answer
  • What is computer?explain any five characteristic in short.​
    9·2 answers
  • Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.Group of answer choi
    14·1 answer
  • which of the following statements about the evolving relationship between traditional newspaper operations and blogging is true?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!