Smallest in Array Program in Java
import java.util.*;
public class SmallestInArray
{
public static void main(String[] args)
{
int ar[] = new int[10];
int s;
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 10; i++)
{
System.out.print("Enter the number ar[" + i + "]:");
ar[i] = sc.nextInt();
}
s=ar[0];
for (int i = 9; i > 0; i--)
{
if(ar[i]
Output:
Enter the number ar[0]:1 Enter the number ar[1]:5 Enter the number ar[2]:4 Enter the number ar[3]:6 Enter the number ar[4]:7 Enter the number ar[5]:45 Enter the number ar[6]:2 Enter the number ar[7]:77 Enter the number ar[8]:48 Enter the number ar[9]:63 Smallest=1