Java program to find largest number in array

In this tutorial, Java program to find the largest number in array.
Here is simple algorithm to find larget element in the array.

  • Initialize lrg with arr[0] i.e. first element in the array.
  • If current element is greater than lrg, then set lrg to current element.

Output:

Enter Array Size : 5
Enter Array Elements : 34 85 95 25 75
Searching for the largest Number….

Largest Number = 95

That’s all about Java program to find largest number in array.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *