Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input begins with an integer indicating the number of integers that follow. You can assume that the list will have at least 2 integers and fewer than 20 integers. Ex: If the input is: 5 10 5 3 21 2 the output is: 2 3 To achieve the above, first read the integers into an array. Hint: Make sure to initialize the second smallest and smallest integers properly.

Answers

Answer 1

Answer:

Following are the code to this question:

import java.util.*;//import package

public class Main //defining a Main class  

{

   public static void main(String[] args)//defining a main method  

   {

       Scanner oxc = new Scanner(System.in);//defining main method  

       int n,m1,m2,num,t,i;//defining integer variable

       n= oxc.nextInt();//input value from user end  

       m1 = oxc.nextInt(); //input value from user end

       m2 = oxc.nextInt(); //input value from user end

       if (m1 > m2)//defining if block that check m1 greater then m2  

       {

           //swapping the value

           t= m1;

           m1 = m2;

           m2 = t;

       }

       for (i=2;i<n;i++)//defining for loop that check the smallest value    

       {

           num = oxc.nextInt();//input value from user end

           if (num < m1) //defining if block that check num lessthan m1

           {

               m2 = m1;//store m1 value into m2  

               m1 = num;//store num value into m1

           }

           else if (num<m2)//defining else if block that check num lessthan m2

           {

               m2 = num;//store m2 value in num

           }

       }

       System.out.println(m1 + " " + m2);//print value

   }

}

Output:

5

10

5

3

21

2

2 3

Explanation:

In the above-given code, inside the main class the main method is declared, in method 6 integer variable "n,m1,m2, num,t, and i" is declared, and in the "n, m1, m2, and num" is used for input the value from the user end.

In the next step, and if block is defined that check m1 greater than m2, and swap the value.In the next step for loop s used that defines two conditions that check the two smallest value from the user input and print its value.

Related Questions

Display filters and capture filters can be interchanged because they use the same syntax. A. True B. False

Answers

Answer:

Very True

Explanation:

If I am working in a document and wish to follow a hyperlink, what should I do?
Copy the link and paste it in your web browser.
Hold the Control key and click on the link.
Click on the link.
Select Ctrl+K.

Answers

Answer:

Click on the link or copy and paste it to your browser

Explanation:

explain the major innavotions made from the establishment of abacus​

Answers

Answer:

The major innovations made from the establishment of abacus​ is explained below in details.

Explanation:

Industrial Age - 1600

John Napier, a Scottish aristocrat, and statesman dedicated much of his relaxation time to the knowledge of mathematics. He was particularly involved in devising ways to aid calculations. His greatest offering was the discovery of logarithms. He recorded logarithmic measures on a set of 10 boarded rods and thus was capable to do multiplication and division by equaling up numbers on the sticks. These enhanced identified as Napier’s Bones.

GIVEING BRAINLIST TROLL ANSWERS GET REPORTED Don't worry about making a vid 100 POINTS IF U DONT KNOW DONT ANSWER UNIT 2
Lab

Each lab includes instructions or questions requiring the use of the internet to complete the task. Please use complete sentences and appropriate headings where applicable. If included, refer to the rubric below to see how you will be graded. Note that links open a new browser window.


Submit your work as a file attachment using the dropbox tool.


This lab is worth 10 points.


UNIT 2 LAB

Chemistry Matters

Subjects that we learn in school can lead us down all kinds of different career pathways. In these three cases, watch how an interest in chemistry helped some people find the perfect career. Note how each of these chemistry enthusiasts ended up in different career clusters.


Career Connections: Food Scientist


Career Connections: Chemical Engineer


Career Connections: Chemist


Now imagine that you are a reporter. Your local high school has decided to do away with chemistry class because no one seems to want to take it. You have been asked to do a five-minute news segment on the ways that keeping the chemistry class can positively impact the community. To prepare for the segment, watch the above videos and consult the Bureau of Labor Statistics’ Occupational Outlook Handbook.


In your video, answer the following questions:


How did chemistry prepare each of these people for their career?

What opportunities was each person able to take advantage of as a result of their background in chemistry?

What is the career outlook for each of these careers?

How you get into the field (Hint: See the “How to become…” section of the Occupational Outlook Handbook)

Typical pay (Hint: See the “Pay” section of the Occupational Outlook Handbook)

How fast this career is expected to grow (Hint: See the “Job Outlook” section of the Occupational Outlook Handbook)

How does each person’s work benefit the community? (This will help people understand the importance of offering chemistry to those who are still in school.)

It’s up to you to convince your viewers that chemistry can be useful in planning their career paths! Create and upload a five-minute video of your news segment.


TABLE Grading Rubric

Video Mechanics Video Content

Full Credit

Student has submitted a video that is clear and five minutes long.


Student has discussed all three careers and answered all four questions.


Partial Credit

Student has submitted a video that is unclear OR that is less than five minutes long.


Student has discussed one or two of the careers OR student has not adequately answered all four questions for each career.


Little Credit

Student has not submitted a video OR student’s video is unclear.


Student has not discussed the three careers OR student has not answered the questions.


?

Answers

How did chemistry prepare each of these people for their career?

All of their jobs are related with some form of Chemistry. Food Scientists work with different foods, and working on making better ones. Chemical Engineers focus on finding new and innovative uses for different elements. And Chemists focus on different breakthroughs in the periodic table. It all came from the first Chemistry Course they took in high school.

What opportunities was each person able to take advantage of as a result of their background in chemistry?

As said previously, they all studied chemistry from College (Maybe even High School.) If they never took these courses, they would be behind and it would be much harder for them to pursue any of these careers.

What is the career outlook for each of these careers?

All of these careers make $72,610  per year, as of 2015. This is a whole $6,050 per month, $1,512 a week. Plenty of influential people were Chemists, included Alfred Nobel, Marie Curie, and Louis Pasteur.

How you get into the field (Hint: See the “How to become…” section of the Occupational Outlook Handbook)

To enter the field, you need to start studying Chemistry. There are many paths of Chemistry, such as Biochemistry and Chemistry. These each branch out in several different ways. Think of it like a tree.

Typical pay (Hint: See the “Pay” section of the Occupational Outlook Handbook)

As said in an earlier segment, the average Chemist makes $72,610 per year, as of 2015, and the average Chemical Engineer makes up to 90k per year.

How fast this career is expected to grow (Hint: See the “Job Outlook” section of the Occupational Outlook Handbook)

This is a career that will always be needed. Discovering new elements for the periodic table is extremely important. No matter where we live, whether in America, in Europe, even on another planet, this job will always be a necessity.

How does each person’s work benefit the community? (This will help people understand the importance of offering chemistry to those who are still in school.)

Each person's work is extremely beneficial, because without this branch, and every chemist's work, we would not have:

1. Clean Water

2. Gasoline

3. Antibiotics or Vaccines

4. Electricity

5. Plastic

And many other things would not exist.

Describe the general strategy behind deadlock prevention, and give an example of a practical deadlock prevention method.
Multi-programming (or multi-tasking) enables more than a single process to apparently execute simultaneously. How this can be achieved on a uni-processor?]

Answers

Answer:

In multi-programming, you use semaphore constructs to protect shared resources. Your program thread or process will block if you want to claim a semaphore when another thread or process has it claimed.

Generally you need to keep the code scope of the claimed semaphore (a.k.a. the critical section) as small as possible, and also, prevent claiming another semaphore within a given critical section.

When an organizatin needs a program to do a very specific job, it mayhire someone to write _____ software.​

Answers

Code sofware your welcome

A formal method for designing and representing human-computer interaction dialogues using box and line diagrams is called:________.

Answers

Answer:

Dialogue Diagramming

Explanation:

Dialogue is simply a sequence of interaction that usually occurs between a user and a system.it consists of Designing the dialogue sequence, Building a prototype and Assessing Usability

Dialogue diagramming is a known widely anf formal means by which we are designing and representing human-computer dialogues using box & line diagrams.

Analyze the needs of the National Security team and help them articulate its problems, develop solutions to meet its needs, and deliver a recommendation that is aligned with the extant national objectives.

Answers

Answer:

Following are the solution to this question:

Explanation:

The Council's role has been to assist and support the President regarding national security and foreign policies ever since its inception under Truman. This Committee often acts as the primary arm of a President to organize these initiatives between government agencies.

The Leader holds sway over the NSC. Its Secretary Of Defense offers a range of options for the Administration on policy issues. The director of national intelligence helps prepare the administration's foreign travel, among other tasks, and offers context memos and staffing for the administration's discussions and phone interviews involving global leaders.

Safety investments were taken for many years utilizing threat cost-benefit analysis wherein the effect metric has been largely focused on even a risk reduction comparative estimate. To evaluate investment decisions, most aim to conduct similar analyses.

Even so, the potential threat is much harder to measure for high-security installations that potential hazard since the likelihood of an attack is highly uncertain and depends strongly on undefinable psychological factors like deterrence as well as the intensity of enemy goals.

Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.

5 3
9 3
5 7
9 7

Answers

Answer:

I took a screenshot of the test withe that question

Explanation:

What is a router?
1. a special computer designed to accomplish tasks
2. a device that sends data to the receiving device
3. a set of data sent across networks
4. an Internet site available only to members of a group

Answers

Answer:

3

Explanation:

Answer:

it would be 3

Explanation:

because origanally a router is a dwvice that forwards data packets between computer networks.

Which focal length and aperture combination is most likely to give you a deep depth of field?
a)50mm f2
b)120mm f4
c)18mm f22
d)120mm f5.6
50 points and brainliest mark

Answers

Answer:

f/11 is the answer I think

In the Dognition_aggregated_by_DogID data set, what is consistent about the relationship between breeding group and number of tests completed, regardless of whether you aggregate the variable representing the number of tests completed by the median or the average of the breeding group?

Answers

Answer:

Toy dogs

Explanation:

Tableau is an application used for statistically analyzing and visualizing data. It is very popular for its ecstatic data visualization figures and works with all dataset types to create a tableau data format.

The Dognition_aggregated_by_DogID dataset holds data for the different dog types, breeding, and tests done on them. The consistent relation between the breeding group column and tests completed is the toy dogs.

True or false?
as the speed of a vehicle increases the amount of tire tread touching the road also increase.

Answers

True
Hope this is right and have a great day!

Write a method called isMagicSquare that accepts a two-dimensional array of integers as a parameter and returns true if it is a magic square. A square matrix is a magic square if it is square in shape (same number of rows as columns, and every row the same length), and all of its row, column, and diagonal sums are equal. For example, [[2, 7, 6], [9, 5, 1], [4, 3, 8]] is a magic square because all eight of the sums are exactly 15.

Answers

Answer:

def isMagicSquare(myArray: list) -> bool :

   row_num = len(myArray)

   cols_num = [len(x) for x in myArray]

   count =0

   for x in cols_num:

       if row_num == x:

           count += 1

   if count == len(cols_num):

       return True

   else:

       return False

print(isMagicSquare([[1,2,3,1],[3,34,2,4],[43,5,7,5],[2,3,4,5]]))

Explanation:

In object-oriented programming, a method is a function defined in a class. Methods are actions that can be taken or executed in a class or to a class object.

The "isMagicSquare" is a python function or method in a class that returns true if a two array or list is a perfect square (same column and row length).

Write a version of the sequential search algorithm that can be used to search a sorted list. Write a program to test the sequential search algorithm. Use either the function bubbleSort or insertionSort to sort the list before the search. Your program should prompt the user to enter 10 digits and then prompt the user to enter a digit to search - if the list contains this digit, output its position to the console:

Answers

Answer:

#include <iostream>

using namespace std;

void insertionSort(int myArr[]){

  int currentvalue, position;

  for (int i = 1; i < myArr.size(); ++i){

    currentvalue = myArr[i] ;

    position = i;

    while (position>0 and myArr[position-1]>currentvalue){

        myArr[position]= myArr[position-1] ;

        position = position-1 ;

     }

    myArr[position]= currentvalue;

  }

}

int main(){

   int numberList[10], search;

   for (int x = 0; x < 10; ++x){

       cin>> numberList[x];

   }

   insertionSort(numberList);

   cout << "Enter the search term/number: ";

   cin>> search;

   for (int i = 0; < 10; ++x){

       if (search == number[i]){

           cout<< i;

           break;

       } else {

           cout<< "Number does not exist.";

       }

}

}

Explanation:

The C++ source code defines the insertionSort void function, then prompts the user ten times to fill the array numberList. It uses the insertion sort algorithm to sort the array of ten items and then a number is searched using a sequential search algorithm.

what is priori criteria in econometric?

Answers

a priori probability refers to the likelihood of an event occurring when there is a finite amount of outcomes and each equally likely to occur. the outcomes in a priori probability are not influenced by the priori outcome.

Answer:hbvfcxzsxdfcgvhbgfds

Explanation:

Bradley is working on a program that uses different classes in specific relationships. Help him remember what these relationships are called.

(blank) is when a class uses objects of another class.

A. Aggregation
B. Inheritance
C. Dependency

(blank) is a special case in which one object “owns” another.

A. Dependency
B. Composition
C. Aggregation

Answers

Answer:

First one is INHERITANCE. Second one is AGGREGATION.

Which of these parts serves as the rear cross structure of a vehicle?
Rear body panel
Rear bumper cover
Rear rails
Rear core support
ontents

Answers

Answer:

Rear bumper cover

Explanation:

describe the impact of technology in your life . how does it affects your human relations with other people .​

Answers

Answer:

Technology has a huge impact on my life, it has helped me visit places, talk to people, and captivate me. For example, using a car I have visited my friends and family. This is making a stronger bond with those people I visited. And, using my phone I can call and text people. this has led to making lots of friends and stronger relationships. Technology is important for human contact unless you want to ride carriages around the streets.

if opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss​

Answers

Wait, where’s the picture and answer choices ? For the answer

Explanation:

if opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss

Question 24 Multiple Choice Worth 5 points)
(01.04 MC)
Zavier needs to compress several files. Which file type will allow him to do this?
ODOC
GIF
OJPG
O ZIP

Answers

Answer:

ZIP

Explanation:

ZIP is a type of compression file as Jpg is a picture file, Gif is a picture file, and ODOC stands for Oklahoma Department of Corrections

TBH:

it may be O ZIP but i've never heard of it.

Answer:

Zip (D)

Explanation:

Took The Test

Learning Task 3: Below are different electronic diagrams. Write the name of
the diagram on your answer sheet.
BELL
Input
Video
Transform
Quantization
Entropy
Coding
Output
Bitstream
Inverte
Quantization
1 2 3
Inverse
Transform
Number to be
dropped when
energized by
electric current
Annunciato
DOOD
Intor intra
Prediction
Frame
Buffer
Ordinary
Push Button​

Answers

Answer:

WAOW

Explanation:

You did better than I can

Which binary number is equivalent to the decimal number 104?

Answers

The correct answer is 0110100 :)

Why is it important to proofread your work even after using the Spelling and Grammar tool?

To make sure you have the correct word count
To make sure your document layout is correct
To print your document correctly
To catch mistakes the spelling and grammar check will not catch

Answers

Answer:

To catch mistakes the spelling and grammar check will not catch.

Explanation:

Grammar and spelling check is not always perfect!

It is the 4th one, to catch mistakes the spelling and grammar check will not catch.

some of the ways we can resolve IPv4 address shortage

Answers

Answer:

NAT

Proxy

IPv6

Explanation:

Network Address Translation (NAT) allows a local area network (LAN) to connect to the internet using only one external IP address. The LAN addresses (typically 192.168.x.x) can be used over and over again.

A proxy is a computer that makes requests to the internet on behalf of the computers on a LAN. It is a more restricted flavour compared to the NAT, but the effect is the same.

IPv6 is a new addressing scheme that will use a 48 bits address space rather than a 32 bits address space of IPv6, and that would provide plenty of addresses.

Which of the statements below does not describe how to print a document?
O Click on Print in the system tray.
Click on Print from the dialog box,
Select Print from the File menu.
O Click on the Print icon at the top of the screen.

Answers

Answer: system tray is what carries the papers

Explanation:

Answer:

yeeeeeeer

wwww

w

w

w

w

w

w

w

Explanation:

wwww

User max owns a directory games, containing a text file called ourgames.txt that he shares with users belonging to the group gameplayers. Those users may read and execute this file, but not delete it. They may not add other files to the directory. Others may neither read, write, nor execute anything in games. What would be the appropriate ownerships and permissions for both directory games and the file ourgames.txt look like

Answers

Answer:

The directory games folder: drwxr-x---

ourgames.txt files : -rwxr-x---

Explanation:

The directory games and the ourgames.txt file are owned by max who has read, write and execute permissions for both, where the 'd' in the first column represents the directory. The gameplayers group has read and execute permissions represented by the 'r' and 'x' letters. The other group is the third section with just dashes which means no permission is granted for the file.

Create a view named MAINE_TRIPS. It consists of the trip ID, trip name, start location, distance, maximum group size, type, and season for every trip located in Maine (ME). Write and execute the CREATE VIEW command to create the MAINE_TRIPS view. Write and execute the command to retrieve the trip ID, trip name, and distance for every Biking trip. Write and execute the query that the DBMS actually executes. Does updating the database through this view create any problems

Answers

Answer:

CREATE VIEW [MAINE_TRIPS] AS

SELECT trips_id, trip_name, start_location, distance, maximum_group_size , type, season

FROM trip

WHERE STATE = 'ME';

- To update a view, use the CREATE OR REPLACE VIEW clause. This would update the view with no errors.

Explanation:

The SQL statement above creates a view called MAINE_TRIPS from the trip table. A view is a virtual table that hold the result of query from an actual table.

It accepts all clauses like a normal table. For example, to get the trip id, name and distance column and the rows with the trip type biking;

SELECT trip_id, trip_name, distance FROM [MAINE_TRIPS]

WHERE type = 'biking'

Amber is working as an intern at a local law firm to learn all she can about the field of law. She is having a difficult time completing her work on time because she doesn't understand everything. What can Amber do?

Ask her manager for help.
Look for another internship.
Look up information online.
Stay late to finish the work.

Answers

Answer:

i think c

Explanation:

not sure

Answer:

A . ask her manager for help.

Explanation:

which port is used for RDP

Answers

Answer:

RDP servers are built into Windows operating systems; an RDP server for Unix and OS X also exists. By default, the server listens on TCP port 3389 and UDP port 3389. Microsoft currently refers to their official RDP client software as Remote Desktop Connection, formerly "Terminal Services Client".

Explanation:

Usually using TCP port 3389, the Remote Desktop Technology (RDP) is a Microsoft-exclusive protocol that permits remote connections to other computers.

What is RDP?

RDP stands for remote desktop protocol. It is defined as a proprietary protocol created by Microsoft that offers a graphical user interface for connecting to another machine over a network connection Using the Remote Desktop Protocol, remote users can access and utilize Windows on a device in a different location (RDP).

The server often listens on both UDP port 3389 and TCP port 3389. It makes use of port 443, which employs an SSL tunnel to send data. In order to increase network security, port 3389, which is used for Remote Desktop connections, is restricted.

Thus, usually using TCP port 3389, the Remote Desktop Technology (RDP) is a Microsoft-exclusive protocol that permits remote connections to other computers.

To learn more about RDP, refer to the link below:

https://brainly.com/question/3895875

#SPJ2

Other Questions
there are 14 crayons and 30 markers in a pencil box. what is the ratio of crayons to marker Both employers and colleges often have a place for you to include your interests on theirO evaluationO surveyO applicationO wish listThe correct answer is application HELP FIVE STARS,THANKSAND BRAINLIEST (if your right)!!What is the y-coordinate of the point shown in the graph? P.S the graph is in the picture above. A rectangle has an area of 135 ft 2 . What is the length, if the width is 9 ft? plis helpFind the distance from the origin to the graph of 6x+3y+2=0a.0.33b.0.31c.0.3d.0.32 which answer choice is it? What is the unit rate depicted in the graph?On a coordinate plane, a graph titled Lap Times has minutes on the x-axis and Laps on the y-axis. A line goes through points (4, 3) and (8, 6).0.75 laps in one minute1.25 laps in one minute3 laps in 4 minutes4 laps in 3 minutes Body weight 7,056 kN. What is its mass? $2665 is compounded annually at a rate of 9% for 1 year Which of the following best describes the theme of both texts? Life is not always easy, and it is not always fair. Humans' love of nature will triumph over humans' love of other humans. It is more important to be good friends with a few people than shallow friends with many people. Life is full of difficult decisions, each decision we make can have a lasting effect on our lives How does our lung's architecture ensure that very little oxygen is wasted? Kaitlyn is sharpening a pencil that is 19 cm. Each time she sharpens it goes down 2.5 cm. If she sharpens her pencil 4 times. How many centimeters of pencil does she have left? please help! i'll give brainliest. what is it called when a magnet causes the atoms in a non-magnetic metal to line up and act like a magnet?a: oriented magnetb: permanent magnetc: non-magnetd: induced magnet Find the value of x. Round your answer to the nearest tenth. in the given figure, the side BC is produced tothe points o and E both sides. Prove thatABE + ACD+ BAC = 180 Can someone please help me . Will mark brainliest !! Which of the following statements does not accurately describe the location of Western Europe?A.Western Europe is west of Asia.B.Western Europe is north of Africa.C.Western Europe is just to the east of the Pacific Ocean.D.Western Europe is south of the Arctic Ocean. Explain why you think it is useful to understand how different parts of the bodywork. help me please with compromise of 1850 I need this answer ASAP