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
. ____________is/are the JSP ImplicitObject(s).sessionapplicationconfigAll of GivenNone of Given
Lynna [10]

Answer:

All of Given

Explanation:

JSP provides a number of implicit objects which are made available by the container and can be used directly in scriptlets. These objects include:

  • session
  • application
  • config
  • out
  • request
  • response
  • pageContext
  • page
  • exception

Example usage:

<% session.setAttribute("userid","demoid"); %>

<% application.getContextPath(); %>

<% out.println(config.getServletName()); %>

5 0
3 years ago
What is food technology​
bonufazy [111]

Answer:

is the application of food science to the selection, preservation, processing, packaging, distribution, and use of safe food. Related fields include analytical chemistry, biotechnology, engineering, nutrition, quality control, and food safety management.

Explanation:

4 0
3 years ago
Which education and qualifications are most helpful for Law Enforcement Services careers? Check all that apply.
bixtya [17]

Explanation:

For IAS..we need a high amptual amount of knowledge..

For IPS..we need master degree and physical fitness too..

For An Advocate..we need Master degree and social Skills..

so..the education and qualifications depends on the various jobs..

HOPE THE ANSWER IS USEFUL

3 0
3 years ago
Your website is currently at position 5 in organic search. On a monthly basis you currently get on average 5,432 clicks and 32 c
Natalka [10]

Answer:

Answered

Explanation:

This one is worth if I can get more number of clicks and the conversions.

SEO plays a vital role in bringing the website ahead of the competition. In the long run, if a website can reach their target audience with the organic search, then it saves a lot spending over the paid campaigns to bring business. Bringing the website to first position will automatically increase the impression which in turn will result in the more clicks and conversions.

7 0
4 years ago
What do you think of my profile picture
Gnom [1K]

ayo it's pretty sweet lma.o.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which statement prints "hi" on the screen?
    5·2 answers
  • Typohunting is registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes
    5·1 answer
  • What do yo need to do for device manager to display nonpresent devices?
    9·1 answer
  • Will a tablecloth that is 155 cm long cover a table that is 1.6 m long?
    12·2 answers
  • Consider a satellite orbiting the earth. Its position above the earth is specified in polar coordinates. Find a model-view matri
    12·1 answer
  • Which of the following is not given to a client computer when it is first installed on a TCP/IP network so that it has the appro
    9·1 answer
  • Is Missouri a free state or a slave state​
    13·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • What do you understand by the term polysome?​
    14·1 answer
  • In _____, a program running on a Web server creates a Web page in response to a request for specific information from a Web clie
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!