Ask Question
19 September, 16:46

Write a Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer. Use a counter-controlled while iteration.

+4
Answers (1)
  1. 19 September, 18:03
    0
    import java. util. Scanner;

    public class LargestSmallest {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. print ("Enter 10 integers: ");

    int num = in. nextInt ();

    int i = 1;

    int min = num, max = num;

    while (i < 10) {

    num = in. nextInt ();

    if (num > max) max = num;

    if (num < min) min = num;

    i++;

    }

    System. out. println ("Largest number: " + max);

    System. out. println ("Smallest number: " + min);

    }

    }

    Explanation:

    A Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer is written above.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer. Use a ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers