We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4911222 commit 5f94eb8Copy full SHA for 5f94eb8
smallest_element_array.java
@@ -0,0 +1,24 @@
1
+import java.util.Scanner;
2
+class smallestelement
3
+
4
+ {
5
+ public static void main(String[] args)
6
7
+ int [] a = new int [10];
8
+ Scanner s=new Scanner(System.in);
9
+ System.out.print("ENTER THE NO OF ELEMNTS:");
10
+ int n=s.nextInt();
11
+ System.out.println("ENTER THE ARRAY ELEMENT:");
12
+ for(int i=0;i<n;i++)
13
+ a[i]=s.nextInt();
14
15
+ int min = a[0];
16
+ for (int i = 0; i <n; i++)
17
18
19
+ if(a[i] <min)
20
+ min = a[i];
21
+ }
22
+ System.out.println("Smallest element present in given array: " + min);
23
24
+}
0 commit comments