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
____ steganography places data from the secret file into the host file without displaying the secret data when you view the host
EastWind [94]

Answer: Insertion steganography

Explanation: Insertion steganography is the way of encrypting the data with the help of a regular files and message. It is encrypted by the ordinary files because the identification of files can be neglected. This process is carried out just for the protection purpose in extra form and gets decrypted  in the destination port .It has the working based on the replacement of the bits in a file .

8 0
2 years ago
Styles are modified by using the Office clipboard in the Home tab. true or false
cluponka [151]
Your answer is false
7 0
3 years ago
Read 2 more answers
_____ creates a border or space that separates information.
KATRIN_1 [288]
A. Padding
*************
7 0
2 years ago
What dose it need For a device to be considered a kind of computer
const2013 [10]

Answer:

Micro controller or MCU (Microcontroller Unit)

Explanation:

Micro Controller Unit is basically a computer on a chip with all components fabricated onto it. It is the core component of a computer.

A Micro Controller has:

  • Central Processing Unit CPU
  • Random access memory RAM
  • Read-only memory ROM
  • I/O peripherals
  • Timers
  • Serial COM ports

all fabricated on a single chip so that it may be connected via buses for providing the desired functionality.

<h3>I hope it will help you!</h3>
8 0
3 years ago
Read 2 more answers
?an ip address reservation is made by creating an association between an ip address and what type of client identifier?
victus00 [196]
The ethernet address, a.k.a. mac address. That way, a DHCP server can give the same IP address to a returning client.
3 0
3 years ago
Other questions:
  • The _____ icon looks like a clipboard with a page of paper attached. Cut Copy Paste Clipboard
    5·1 answer
  • The posterior auditory stream terminates in the ________ and is involved in ________.
    12·1 answer
  • . The first step in devising security services and mechanisms is to develop a security policy True False
    11·1 answer
  • Sue needs to add a header and a footer to a presentation. Which process should she use to do this?
    10·2 answers
  • A ________ is a self-contained program that spreads through a computer network by exploiting security holes in the computers con
    9·1 answer
  • How much time per day does the average U.S. youth spend watching television, playing video games, or using a computer?
    8·1 answer
  • Rule number one for handling an emergency is to _____. A. buy a new vehicle B. call law enforcement C. remain calm D. restart th
    6·2 answers
  • Many companies use telephone numbers like 555-GET-Food so the number is easier for their customers to remember. On a standard te
    6·2 answers
  • reagan's firm has not had to make large investments in computer or networking hardware or in personnel to maintain the hardware
    9·1 answer
  • try the following code to see a nullpointer error (if you don’t see the error because of the autograding, you can copy it into t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!