Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
smallest number and its index(position)
//Aneesh Pradeep 13.01.2020 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int a[]=new int[5];//declaration for(int i=0; i<5; i++) { a[i] = sc.nextInt(); } System.out.print("Elements in Array are :\n"); for(int i=0; i<5; i++) { System.out.print(a[i] + " "); } int min=a[0]; int min1=0; for(int i=0; i<5; i++) { if (a[i] < min ){ min=a[i]; min1 = i; } } System.out.println(""); System.out.println("Smallest number = "+min + " and index is " +min1); } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Basic Matrix
else if statement
Two Sum in Sorted input array
Find Median in Large File of Integers
Counter.java
Java messing around
JAVA # EN UZUN CÜMLEYİ EKRANA YAZDIRMA
innerclss
HelloWorld2
Leetcode 937. Reorder Log Files🇮🇳🇮🇳🇮🇳
stackse - search stackoverflow differently
Please log in to post a comment.