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
Katyanochek1 [597]
4 years ago
13

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer

s that follow. Assume that the list will always contain less than 20 integers.
That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one.

Ex: If the input is:

5 25 51 0 200 33
0 50
then the output is:

25 0 33
(the bounds are 0-50, so 51 and 200 are out of range and thus not output).

To achieve the above, first read the list of integers into an array.
Computers and Technology
2 answers:
Xelga [282]4 years ago
7 0

Answer:

import java.util.Scanner;

public class ListOfIntegers {

public static void main(String[] args) {

 // Create an object of the Scanner class to allow for user input

 Scanner input = new Scanner(System.in);

 // Prompt the user for the number of integers they want to enter

 System.out.print("Enter the number of integers : ");

 // Get and store the number of integers entered by user

 int n = input.nextInt();

 System.out.println();

 // Create an array to hold the integers

 // The array has the same length as the number of integers

 int[] numbers = new int[n];

 // Create a loop that asks the user to enter all integers

 // At each cycle of the loop, save the entered integer into the array

 for (int i = 0; i < n; i++) {

  System.out.print("Enter number " + (i + 1) + " : ");

  numbers[i] = input.nextInt();

  System.out.println();

 }

 // Prompt the user for the lower bound

 System.out.print("Enter the lower bound : ");

 // Get and store the lower bound in a variable

 int lowerbound = input.nextInt();

 System.out.println();

 // Prompt the user for the upper bound

 System.out.print("Enter the upper bound : ");

 // Get and store the upper bound in a variable

 int upperbound = input.nextInt();

 System.out.println();

 System.out.println("OUTPUT :: ");

 // Create a loop to cycle through the array of numbers.

 // At each cycle, check if the array element is within range.

 // If it is within range, print it to the console

 for (int j = 0; j < numbers.length; j++) {

  if (numbers[j] >= lowerbound && numbers[j] <= upperbound) {

   System.out.print(numbers[j] + " ");

  }

 }

}

}

Explanation:

Please go through the comments in the code for more readability and understanding. The source code file has been attached to this response. Kindly download the file to get a better formatting of the code.

Hope this helps!

Download java
Tema [17]4 years ago
3 0

Answer:

integers=[]

while True:

      number=int(input())

      if number<0:

       break

      integers.append(number)  

print("",min(integers))

print("",max(integers))

Explanation:

You might be interested in
Which of the following are results of technological advancements and increased automation?
vivado [14]

Answer:

increased productivity

Explanation:

sorry if i am not correct

3 0
3 years ago
Read 2 more answers
What are 3 important reasons to reconcile bank and credit card accounts at set dates?
Karo-lina-s [1.5K]

Answer:

To verify transactions have the correct date assigned to them.

To verify that an account balance is within its credit limit.

To verify that all transactions have been recorded for the period.

Explanation:

7 0
3 years ago
Think about the last business that you purchased a product or a service from. What three types of software might they need? Why
Anton [14]

Answer:

a web a networking site and their online purchasing

Explanation:

web for their business networking site for their employees

5 0
4 years ago
Read 2 more answers
____ is a very fast network media. It contains multiple (sometimes several hundred) clear glass or plastic fibers, each about th
nikitadnepr [17]

<u>Fiber optic cable (FOC</u>) is a very fast network media and it comprises multiple clear glass or plastic fibers.

<h3>What is a fiber optic cable?</h3>

A fiber optic cable can be defined as a type of wired connector which are either made of glass or plastic and they are typically used for connecting one network device to another, so as to form a computer network and enable the continuous transmission of data between them.

In Computer technology, fiber optic cables (FOCs) are commonly produced through the use of several concentric layers of transparent material such as glass or plastic, with each having a slightly different index of refraction for light waves and about the thickness of a human hair.

Read more on fiberoptic cables here: brainly.com/question/116766

8 0
2 years ago
How does limiting a company's scope benefit the company?
Alika [10]
If a company only focuses on a few things,they become a niche player in the market,therefore can demand a higher price because they are experts at only a few things.
8 0
4 years ago
Read 2 more answers
Other questions:
  • Consider the following method:
    8·2 answers
  • HELPPPP!!
    8·2 answers
  • WILL UPVOTE ALL plz
    10·1 answer
  • What is a piece of information sent to a function
    15·1 answer
  • A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo
    9·1 answer
  • Assume that a finite number of resources of a single resource type must be managed. Processes may ask for a number of these reso
    10·1 answer
  • Which of these is an example of collective voice?
    8·2 answers
  • You are working for a company that is responsible for determining the winner of a prestigious international event, Men’s Synchro
    5·1 answer
  • Why were Redditors interested in "Mister Splashy Pants"?
    6·2 answers
  • Cidr simplifies how routers and other network devices need to think about the parts of an ip address, but it also allows for mor
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!