array_x
import java.util.*;
public class array_x
{
public static void main(String args[])
{
int a[][]={{2,4,5},{7,9,10},{12,15,17}};
int key=0;
boolean g=false;
Scanner reader= new Scanner(System.in);
System.out.printf("输入一个数字\n");
key = reader.nextInt();
for(int k=0; k<3; k++)
for(int j=0; j<3; j++)
if(key==a[k][j])
{
System.out.printf("a[%d][%d]== %d ==key",k,j,a[k][j]);
g=true;
}
if(g==false) System.out.printf("不在数组中\n");
}
}
posted on 2017-10-21 10:44 MACHINE_001 阅读(87) 评论(0) 编辑 收藏 举报