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
Leno4ka [110]
3 years ago
10

Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the t

hree values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.
Computers and Technology
1 answer:
arlik [135]3 years ago
8 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter the first number: ");

    int n1 = input.nextInt();

    System.out.print("Enter the second number: ");

    int n2 = input.nextInt();

    System.out.print("Enter the third number: ");

    int n3 = input.nextInt();

 System.out.println("largest: " + LargestNumber(n1, n2, n3));

 System.out.println("smallest: " + SmallestNumber(n1, n2, n3));

}

public static int LargestNumber(int num1, int num2, int num3){

    int largestNum = 0;

    if(num1>=num2 && num1>=num3)

        largestNum = num1;

    else if(num2>=num1 && num2>=num3)

        largestNum = num2;

    else if(num3>=num1 && num3>=num2)

        largestNum = num3;

       

    return largestNum;

}

public static int SmallestNumber(int num1, int num2, int num3){

    int smallestNum = 0;

    if(num1<=num2 && num1<=num3)

        smallestNum = num1;

    else if(num2<=num1 && num2<=num3)

        smallestNum = num2;

    else if(num3<=num1 && num3<=num2)

        smallestNum = num3;

       

    return smallestNum;

}

}

Explanation:

Create function called LargestNumber that takes three parameters, num1, num2, num3. Find the largest number using if else structure among them and return it. For example, if num1 is both greater than or equal to num2 and num3, then it is the largest one.

Create function called SmallestNumber that takes three parameters, num1, num2, num3. Find the smallest number using if else structure among them and return it. For example, if num1 is both smaller than or equal to num2 and num3, then it is the smallest one.

Inside the main, ask the user for the inputs. Call the functions and print the largest and smallest.

You might be interested in
Why have countries requested for the removal of content?
Kipish [7]
These links should help u:
https://support.google.com/transparencyreport/answer/7347744?hl=en

https://searchengineland.com/most-censorship-and-content-takedown-requests-come-from-us-says-google-...
5 0
3 years ago
A cyberbully is someone who invades another person’s privacy by
e-lub [12.9K]
Insulting or harassing them over the Internet
8 0
4 years ago
Read 2 more answers
Write a job back with my best Interest
Katena32 [7]

Answer:

be a doctor

Explanation:

u will help people and save them and get paid

6 0
3 years ago
Read 2 more answers
A(n) ______ system is a set of programs that coordinates all the activities among computer or mobile device hardware. a. managem
madreJ [45]

Answer:

Option c is the correct answer for the above answer.

Explanation:

The operating system behaves like the soul of the system. It is because it is used to operate the system. It is also used to operate all the activities of the system. It is also used to manage the resource and can be available on the computer as well as mobile. This is the first software which needs to install on a mobile or computer because without this no software can work on the mobile or computer.

The above question asks about the software which is used to operate the computer as well as mobile. That software is known as the Operating system. So the answer is Option c while the other is not because:-

  • Option 'a' states about the management which is not software.
  • Option b states about the Network which is also not a software.
  • Option d states about the application which is not used to operate the software of the system.
5 0
3 years ago
Which of these is most likely to contribute to the long term of a local ecosystem?
maria [59]
I would help but you didn’t say what these is
8 0
2 years ago
Other questions:
  • Luke is setting up a wireless network at home and is adding several devices to the network. During the setup of his printer, whi
    8·1 answer
  • Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids.Sample output for the g
    11·1 answer
  • Alburry and wagga wagga are 130km apart. How many centimeters apart are they on a map with a scale factor of 1:250000?​
    13·1 answer
  • LILLE VIC LUNCUL ANCI.
    5·1 answer
  • What do secondary sources rely on for their analysis of events?
    6·2 answers
  • What should the timing of transition slides be per minute?
    12·1 answer
  • Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the
    10·1 answer
  • Is pseudocode obtained from Algorithm or is Algorithm obtained from pseudocode?
    8·1 answer
  • List 4 criteria of power your house with wind
    5·1 answer
  • Please say me the answer fast its really urgent........ ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!