You are here: Home / Topics / Program to get Minimum number from an array in Java

Program to get Minimum number from an array in Java

Filed under: Java on 2023-08-19 18:39:26

// Minimum element from array

public class MinimumOfArray
{
   public static void main(String[] args)
   {
       int i,min;
       int a[]={10,60,5,40,50};
       min=a[0];
       for(i=0;i<5;i++)
       {
           if(min>a[i])
           {
               min=a[i];
           }
       }
       System.out.println("Minimum : "+min);
   }
}


Output:

Minimum : 5

About Author:
Y
Yatendra Sir     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.