Write a java program to Find the index of the smallest number in an array

Write a java program to Find the index of the smallest number in an array

Write a java program to Find the index of the smallest number in an array

Program
public class Main 
{
    public static void main(String[] args) 
    {
        int a[] = new int[]{12,44,23,56,9,23,78,13};
        int min = a[0]; int index=0;
        for(int i = 0; i < a.length; i++) 
        {
            if(min > a[i]) 
            { 
                min = a[i];
                index=i;
            }
        }
        System.out.println("Index position of Smallest value in a given array is :"+index);
    }
}


Output:

Index position of Smallest value in a given array is :4



More Questions


42 . Write a java program to find the index of the largest number in an array
43 . Write a java program to Find the index of the smallest number in an array
44 . Write a Program to remove duplicate element in an array
45 . Write a java Program to print odd and even numbers from an array
46 . Write a java program to add two matrix
47 . Write a java Program to check given matrix is null matrix
48 . Add all the digits of a given positive integer until the result has a single digit
49 . Write a Java program to accept a float value of number and return a rounded float value



For latest job updates join Telegram Channel: https://t.me/sateeshm

Apply For The Job

Apply For Job

Java Material

Python Material

PLSQL Material

.Net Material

Java Practice Programs

400 Java Programs