public static void main(String args[]){ int a[]={1,5,6,9,8}; Scanner scan = new Scanner(System.in); int b = scan.nextInt(); int i = 0; for(;i<a.length;i++){ if(b == a[i]){ System.out.println("第"+i+"位"); break; } } if(i == a.length){ System.out.println("不存在"); } }