(Assignment 1 - LargestValue)The process of finding the largest value (i.e., the maximum of a group of values) is used frequently in computer applications. Write a Java application (LargestValue.java) that inputs a series of 10 integers and determines and prints the largest integer. Your program should use at least the following three variables: a. 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). b. number: The integer most recently input by the user. c. largest: The largest number found so far.

View Answers

February 21, 2011 at 12:20 PM

**Java Find Largest Number**

import java.util.*; class FindLargest{ public static void main(String[] args){ int max = Integer.MIN_VALUE; System.out.println("Enter 10 numbers:"); Scanner input=new Scanner(System.in); for(int i=1;i<=10;i++){ int num=input.nextInt(); if (num > max) { max = num; } } System.out.println("Largest Number is: "+max); } }

Ads

Related Tutorials/Questions & Answers:

find largest value (Assignment 1 - LargestValue)The process of finding the largest value (i.e., the maximum of a group of values) is used frequently...; Java Find Largest Number import java.util.*; class FindLargest

USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE i have some... it is: write a program that reads 10 numbers from the keyboard. find the largest number and count the occurrence of the largest number number entered from the keyboard

Advertisements

Find Second Largest Number from an Array This section illustrates you how to find the second largest number from an array. For this purpose, we have allowed the user to enter the array elements of their choice and determine the largest

how to find largest number? this is my java coding: import...); } } i don't know how to add code to find the largest number.. please help... want to find the greater number which user enter on the console? Thanks

find the largest number enter by user sorry for not stating clearly my question. i want to know how to find the largest number enter by user... value: "); a=in.nextInt(); System.out.println("Enter second value

find largest num enter by user using loop method hi..it's me again...(); System.out.println("Enter five value: "); e=in.nextInt(); is it possible to find...); System.out.println("Enter first value: "); a=in.nextInt(); System.out.println("Enter

How to find maximum value in ArrayList **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object

How to find maximum value in ArrayList **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object

How to find maximum value in ArrayList **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object

How to find maximum value in ArrayList **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object

Find max and min value from Arraylist In this tutorial, you will learn how to find the maximum and minimum value element from the ArrayList. Java provides direct methods to get maximum and minimum value from any collection class i.e

Find Value of Column In this program we are going to find the value of row from... example.xls String table value 0 Name Of Example String table value 1

Find Cylinder area By inputting value from user Hello Sir I need the code for calculating the area of a cylinder in which it asks radius value from user and then calculate area using this radius value. Please provide me

How to find maximum value for userdefined objects in ArrayList Hi sir,I have requirement i.e finding maximum value in userdefined objects... value but can't store that object into another object.Please help me how

How to find maximum value for userdefined objects in ArrayList Hi sir,I have requirement i.e finding maximum value in userdefined objects... value but can't store that object into another object.Please help me how

How to find maximum value for userdefined objects in ArrayList Hi sir,I have requirement i.e finding maximum value in userdefined objects... value but can't store that object into another object.Please help me how

it. Write a method to find the largest value in an array. Write a program that takes... to the screen and uses your method to find the largest value in the array, then prints this value to the screen. import java.util.Random; public class

how to find [count the number of integers whose value is less than the average value of the integers] Construct an algorithm that will prompt... of integers whose value is less than the average value of the integers. Your

Insertion sort program find calendar to array value 1000,5000,10000 program find calendar for insertion sort in jfram to array 1000

MySql Absolute Value This example illustrates how to find the absolute value of the table. In this example we use abs keywords to find the absolute value in the sql query. In the given table the column emp_value define float type when

The largest integer among the X number Write an application program that prompts the user to key in a whole number X. The user is then prompted... information : a) The largest integer among the X number of integers keyed in b

; conditions that can help you in finding the largest value one by one. ... Determining the largest number ... the coding for determining the largest number amongst three. Here we have taken three

. These numbers are then stored into an array in order to find the largest...Determine Average by removing Largest and Smallest Number In this section, you will learn how to remove largest and smallest number from the 10 numbers

find the factorial how to find the factorial through the while loop...) { int value = 5, factorial = 1, temp = value; while...--; } System.out.println("The factorial of " + value + " is " + factorial

find and substring **import java.io.BufferedReader; import... BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter find...){ } } public void findreplace(String find, String replace

find and replace in java Need 'find and replace' function in Java to find special keyword in XMl such as @,#,!,%..and replace with their corresponding entities

find the given input is integer or string simple coding for to check the given input value is integer or no.If the given value is integer display "Value is integer" otherwise "Value is not a integer"? class

MySql find and replace string How to find and replace string or special characters in MySql & PHP? Find and Replace String PHP $result = preg_replace('/\band\b/i', 'foo', $subject