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
2 Write<br>a program to and area of<br>4<br>walls. A = 2h (l+b)​
Zanzabum

Answer:

ADGH AVFH VVBLA FDHLAVRGLBHSRGLHFSgh HGK g gH G avoshhbv so bhsf vhbfsb gfsb gb gh g hhow gw

Explanation:

eehhfhsghOhrrbfghedhchggfgsbbfbhdhfhehyfnfnhhsh

3 0
2 years ago
A _____ is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop.
-BARSIC- [3]
A viewport is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop .
6 0
3 years ago
Based on the unit content and your own ideas, how would you define a video game in your own words? What separates a regular vide
lara31 [8.8K]

Answer:

A video game would be a series of steps to produce or outcome / end in the form of controller a character or the how the game can be played and being able to play it at some level, but a good game would have multiple questions and a hard difficulty maybe even a customizable section for your character or object. In other words a Video game would be a series of steps to produce a outcome from controlling a character and a Good video game would be the same but added a level of difficulty and harder mechanics into the game.

Explanation:

Hope this helped :)

3 0
3 years ago
A new computer workstation has been installed in a small office. the user of the workstation can print a document using a networ
ICE Princess25 [194]
The printer is setup as a local printer therefore it does not need access to internet to access the local network printer. Once the new workstation is given access to the terminal server used for the printer, it will not need to connect on the internet to print. Now, if the workstation is not able to access the internet it could be potentially due to incorrect configuration of DNS to the workstation or actual issue is within the ISP.
3 0
3 years ago
What is the reddish-brown substance in the water?
Mariulka [41]

Answer:

iron

Your water might be affected by iron, which is a commonly-occurring constituent of drinking water. Iron tends to add a rusty, reddish-brown (or sometimes yellow) color to water. If the color is more black than red, your water might contain a combination of iron and manganese.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which line of code will generate a random integer between 7 and 77?
    10·1 answer
  • __________ has led to the belief that the Internet is "free".
    8·1 answer
  • #11. Write a program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the nu
    6·1 answer
  • To use the AutoCalculate area, select the range of cells containing the numbers for a calculation you want to verify and then pr
    7·1 answer
  • The architecture that the large paper company Mohawk adopted enables the company to scale technology services up and down instan
    14·1 answer
  • What are the advantages of customer relationship managment​
    10·1 answer
  • WILL GIVE MORE POINTS, PLEASE HELP!!!
    11·1 answer
  • OBJECTIVE QUESTIONS
    10·1 answer
  • WILL GIVE BRAINLIEST!!! PLEASE HELP!!!
    5·1 answer
  • Write a complete program that declares an integer variable
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!