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
What type of software is needed access the internet
VLD [36.1K]

Google Chrome, Firefox, Internet explorer, etc....

4 0
2 years ago
Read 2 more answers
When an instrument in the dashboard of your car informs you the air pressure in the right rear tire is low, what type of compute
inessss [21]

Answer:

embedded computer

Explanation:

Based on the information provided within the question it can be said that the computer that determines this is called an embedded computer. This is a microprocessor-based system that is uniquely designed in order to perform a single specific task. Once it does so, it saves the information and can be used in a much larger system such as a car dashboard system.

4 0
3 years ago
Tres areas donde se aplica la ciencia y tecnologia
aksik [14]

Possible Answers:

- Medicemanto - Medicine, especially applied.

- Ingeniería - Engineering. Modern scientific engineering is making use of technology to help solve problems and understand cause and effects.

- Comunicación - Communication. Public broadcasting to raise awareness of environmental or other scientific concerns.

7 0
2 years ago
To enforce the concept of separating class definition from its function implementations, where should the function implementatio
zzz [600]
D(in a .c file ) because that is where it should be placed :)
4 0
2 years ago
2. Which of the following statements accurately describes enzymes? A. Enzymes increase the activation energy of reactions. B. Te
Bas_tet [7]
B.temperatute and pH can affect how enzymes work
5 0
2 years ago
Other questions:
  • OSHA's mission is to: A. Ensure that all workers receive adequate workers' compensation payments B. Esnure that all workers rece
    8·2 answers
  • How can our perceptions help us to choose the channel for our message?
    5·1 answer
  • In which of the following situations will a macro make your work more efficient?
    9·1 answer
  • Write a algorithm to attend birthday party​
    8·2 answers
  • ou use productivity apps on your iPad tablet device while traveling between client sites. You're concerned that you may lose you
    11·1 answer
  • What are the origins of the parking barrier?
    12·1 answer
  • Phishing is ____________. When hackers overwhelm a website with too many requests. A network of private computers infected with
    7·1 answer
  • The term technology is derived from the Chinese word. it is true or false​
    9·2 answers
  • Consider the following code snippet that appears in a subclass: public void deposit(double amount) { transactionCount ++; deposi
    14·1 answer
  • A multiprocessor with 10 processors has 36 attached tape drives. A number of jobs have been submitted to the system where each j
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!