About 5,110,000 results
Open links in new tab
  1. Java program to find the largest & smallest number in n numbers

    Jun 17, 2015 · System.out.println("the largest is:"+large); //gives the largest number in n numbers. code for the smallest.. if(i==0&&num>0) small=num; if(num<small) small=num; System.out.println(small); Your code work for me after changing small to smallest. You couldn't figure the condition for smallest number when you wrote that if block for largest number?

  2. JAVA program to find largest of n numbers in a given array

    This JAVA program is to find the largest element from a given array. For example, if an array a consists of elements a={17,58,2,39} and if we want to find the larges t element then the largest element would be 58.

  3. Java Program to Find Largest Element in an Array

    Apr 9, 2025 · Finding the largest element in an array is a common programming task. There are multiple approaches to solve it. In this article, we will explore four practical approaches one by one to solve this in Java. Example Input/Output: Below …

  4. java - Find n highest numbers - Stack Overflow

    Feb 13, 2012 · You can iterate through all numbers (reading them from a media one by one for example) and only keep a list with the 10 maximum numbers. In pseudo code: max_numbers = new int[n] until not end of file: read number if number > min(max_numbers): 'copy number to minimum value of max_numbers'

  5. How to Find Largest and Smallest of N numbers without using ... - Blogger

    Sep 25, 2023 · Here is our sample program to find the smallest and largest of N integers without using an array. This program handles both positive and negative numbers, hence the largest value is initialized with Integer.MIN_VALUE and smallest number are initialized with Integer.MAX_VALUE.

  6. Java Project - Find the Largest number in an Array or List

    Oct 5, 2024 · Learn how to find the largest number in a list using two methods: a for loop and the Arrays class. Includes clear code explanations and examples for beginners.

  7. Java Program to Find Largest Number in an Array - Java Guides

    This guide will show you how to create a Java program that identifies and displays the largest number in a given array. Problem Statement. Create a Java program that: Takes an array of integers as input. Finds and displays the largest number in the array. Example 1: Input: {3, 5, 7, 2, 8} Output: The largest number is 8; Example 2: Input: {12 ...

  8. Java program to find the largest and smallest of n user input numbers

    Nov 22, 2022 · Let’s learn how to write a Java program that finds the largest and smallest of n user-input numbers. We will learn how to solve it by using an ArrayList and without using an ArrayList. Example 1: Java program by using an ArrayList: In this example, we will use an ArrayList to hold the user input values. It will ask the user to enter the ...

  9. Java Program to Find Largest Number in an array - Tpoint Tech

    Sep 9, 2024 · We can find the largest number in an array in java by sorting the array and returning the largest number. Let's see the full example to find the largest number in java array.

  10. Java Program to Find the Largest Number in an Array | Edureka

    Nov 29, 2022 · In this tutorial, I am going to help you to build a Java code through which you can find out the largest number in an array. After you enter the numbers of the array as an input, the program will start comparing the numbers with each other and reach its conclusion.

  11. Some results have been removed
Refresh