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
san4es73 [151]
3 years ago
9

c Write a program that, given a series of integer numbers, identifies the two largest numbers in the list. The user will specify

at the beginning how many numbers will be in the list; you may assume that there will always be at least two numbers entered.
Computers and Technology
1 answer:
Dominik [7]3 years ago
4 0

Answer:

import java.util.Arrays;

import java.util.Scanner;

import java.util.Collections;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("How many numbers: ");

       int num = in.nextInt();

       int [] numArray = new int[num];

       for(int i =0; i<numArray.length; i++){

           System.out.println("Enter the numbers: ");

           numArray[i]= in.nextInt();

       }

       //Print the list of numbers entered

       System.out.println("You entered these numbers "+ Arrays.toString(numArray));

      //finding the minimum

       int min = numArray[0];

       for(int i =0; i<numArray.length; i++){

           if (numArray[i]<min) {

               min = numArray[i] ;

           }

       }

       System.out.println("The minimum is "+min);

       int max = numArray[0];

       for(int i =0; i<numArray.length; i++){

           if (numArray[i]>max) {

               max = numArray[i];

           }

       }

       System.out.println("The maximum is "+max);

   }

}

Explanation:

In the program above;

The user will be prompted to enter the length of the list  (n) with the assumption that it will always be more than two

An array is created of the size (n)

User is prompted to enter the numbers in the list

Using a combination of for loops and if statements, the max and min is outputed

You might be interested in
You need to immediately terminate process id 2129. which command should you use?
kolezko [41]
<span>The kill -9 2129, kill -s KILL 2129, or kill -KILL 2129 commands</span>
8 0
3 years ago
Which of the following is the largest measurement for the weight of a bag of dog food?
jasenka [17]

Answer:

approximately 5 lbs but no sure weight.

6 0
3 years ago
Read 2 more answers
You recently purchased a new laptop for home. You want to ensure that you are safe from malware. You should install a personal _
german

Answer:

You should install a personal firewall, a program that protects your computer from unauthorized access by blocking certain types of communications.

Explanation:

In computing, a firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules. A firewall typically establishes a barrier between a trusted internal network and untrusted external network, such as the Internet.

8 0
4 years ago
Give a common business example that mimics the differences between a shared
Serhud [2]

An  business example that mimics the differences between a shared network segment and a dedicated network segment is that of connection of work station transmission.

<h3>What is Shared segment network?</h3>

In this type of network,  local area network or an aspect of the local area network is said to have a lot of workstations and the multiple workstations are linked by using a hub

Note that all the workstation do not need to share the network capacity with other workstations but  an  business example that mimics the differences between a shared network segment and a dedicated network segment is that of connection of work station transmission.

Learn more about network segment from

brainly.com/question/7181203

#SPJ1

6 0
2 years ago
The school has determined that finding the absolute best schedule cannot be solved in a reasonable time. Instead they have decid
Anettt [7]

Answer:

i dont know what to say

Explanation:

... speechlessss

4 0
3 years ago
Other questions:
  • What risks and safeguards are associated with wireless communication? what is “war driving” or “war flying”? are you comfortable
    14·1 answer
  • Where does communication take place?
    12·1 answer
  • A _____ is inserted so that a portion of a document that can have different formatting from the rest of the document. a. heading
    9·1 answer
  • 1. Before operating any power tool, you need to
    14·1 answer
  • You load an image file into a numpy array and look at its shape, which is (433, 650). What does this indicate?
    13·1 answer
  • Last bittttt of points
    8·1 answer
  • How does design influence the product's function?
    5·1 answer
  • What are some random fun facts about Technology?
    12·1 answer
  • The pH scale is_____ ?
    5·1 answer
  • PLEASE HELP!
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!