Tuesday, February 8, 2022

Minimum Number in an Array in Java

  A program to check and display the minimum number in an array using Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing



public class minimum

{

    public static void main(String[] args)

    {

     

         //Loop through the array  

        int elements[]={-5,300,20,4000,8,341};

        int min = elements[0]; 

        

        System.out.println();

        System.out.print("\tMinimum Number in an Array in Java");

        System.out.println("\n"); 

   

        for (int i = 0; i < elements.length; i++) {  

           if(elements[i] <min)  

               min = elements[i];  

        } 

        System.out.println("\tMinimum Number : "+ min);

        System.out.println();

        System.out.print("\tEnd of Program");

        System.out.println("\n\n");

        }

    }



No comments:

Post a Comment