Computer Science, asked by MaboodHusain, 1 year ago

Read one dimensional array of an element and find the smallest element?​

Answers

Answered by dhyeyvachhani569
2

Lets say we have a single dimensional array of datatype int.

int a[]={3,34,5,8,93,45};

//Declare a variable to hold the first element

int min=a[0];

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

{

   if(a[i]<min)

   min=a[i];

}

System.out.println(min);

Similar questions