(Find the Largest Number) The process of finding the largest number (i.e., the m
ID: 3529727 • Letter: #
Question
(Find the Largest Number) The process of finding the largest number (i.e., the maximum of a group of numbers) is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the contest. Write a pseudocode program and then a program that inputs a series of 10 non-negative numbers and determines and prints the largest of the numbers. [Hint: Your program should use three variables as follows]: counter : A counter to count to 10 (i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed) number : The current number input to the program largest : The largest number found so farExplanation / Answer
import java.util.*; public class Largest { public static void main(String args[] ) { int array[]={2,3,54,78,6,9,23,4,10,19}; Arrays.sort(array); System.out.println("the largest number is :"+array[(array.length)-1]); } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.