本帖最后由 走在这里 于 2015-6-30 21:32 编辑
class LianXi
{
public static void main(String[] args)
{
jiuJiuBiao(4);
int[] arr={1,34,25,67,93};
int index = chaZhao(arr,67);
System.out.println(index);
}
public static void jiuJiuBiao(int n)
{
for (int x=1;x<=n ;x++ )
{
for (int y=1;y<=x;y++ )
{
System.out.print(y+"*"+x+"="+y*x+"\t");
}
System.out.println();
}
}
public static int chaZhao(int[] arr,int key)
{
for (int x=0;x<arr.length ;x++ )
{
if (arr[x]==key)
{
return x;
}
}
return -1;
}
}
|
|