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
sergeinik [125]
3 years ago
14

Write an algorithm to print the minimum and maximum of an integer array. Your need to pass the array as a parameter. Since we ca

nnot return two values (in this case, minimum and maximum), just print them inside the method. You are allowed to use only one loop. i.e. you are not allowed to traverse the array twice. Note: You can write a Java method instead of pseudo-code but pseudo-code is preferred. Following is a template to start your pseudo code. MinMax(A) min
Computers and Technology
1 answer:
sammy [17]3 years ago
4 0

Answer:

See explaination

Explanation:

MinMax.java

import java.util.*;

public class MinMax

{

static void MinMax(int[] arr)

{

int Min=arr[0]; // initializinf min and max with 1st value of array

int Max=arr[0];

for(int i=0;i<arr.length;i++) // iterating loop only once

{

if(arr[i]>Max) // checking max value

{

Max=arr[i];

}

if(arr[i]<Min) // checking min value

{

Min=arr[i];

}

}

System.out.println("Min Number is "+Min); //printing min value

System.out.println("Max Number is "+Max); //printing max value

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter N value: "); // taking n value

int n=sc.nextInt();

int[] arr=new int[n];

System.out.println("Enter N elements:"); // taking n elements into array

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

{

arr[i]=sc.nextInt(); // each element into the array

}

MinMax(arr); // calling MinMax() method.

}

}

You might be interested in
please help, touch pad and trackpad are the same thing and the other answers don’t really make sense to me..
WINSTONCH [101]

Answer:

The answer to the problem is B

8 0
2 years ago
If you created a variable called name, what data type would that value be?
NNADVOKAT [17]
<h2>Answer:</h2>

<h2>A float</h2>

Hope it helps

6 0
3 years ago
Read 2 more answers
Output the following 21%4​
Vadim26 [7]
21%4 is 1.

21-4=17
17-4=13
13-4=9
9-4=5
5-4=1
4 0
3 years ago
Brad is joining a big website design firm. He is worried that he may not be able to adapt to the company culture. What can he do
pickupchik [31]

Answer:

Study the environment and see what frameworks the organization is using. Make friends and learn from people that has being working in that organization.

Don't try to take a project immediately, first work on a project with a bunch of other employees to learn from them.

Explanation:

Be positive and ask questions so you don't make mistakes

3 0
3 years ago
Which type of account is required to utilize the Office Presentation Service?
sergejj [24]

Answer:

D. a Microsoft Account

Explanation:

You can deliver a document from Word using the Office Presentation Service, a free, public service that allows others to follow along in their web browser. No setup is required. Use your free Microsoft account to get started.

It Is Called Powerpoint

5 0
2 years ago
Read 2 more answers
Other questions:
  • Oliver is creating an image of a fruit basket. From the basket, he wants the red apples to stand out among the rest so they will
    9·1 answer
  • If you enter 234.567 into a cell that is formatted to display 1 decimal point place, what is the value stored in the cell
    9·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • .vx*^#♡■●;(<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eaceaa">[email&#160;protected]</a>(;=!^$□◇○(
    13·1 answer
  • How do you run a function in python?
    5·1 answer
  • The cylinder head and engine block are completely sealed by a A. valve seal. B. head gasket. C. intake manifold. D. spark plug
    11·2 answers
  • After a chart has been inserted and formatted, is it possible to change the data range it refers to or to add new rows of data?
    14·1 answer
  • Which of the following is not a skill set required by data scientists? A. Programming expertise B. Big data expertise C. Telecom
    11·1 answer
  • A technician wants to consolidate and log specific alerts from network devices into a database so maintenance tasks and potentia
    11·1 answer
  • Assume that you have an ArrayList variable named a containing 4 elements, and an object named element that is the correct type t
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!