class ar1
{
public static void main (String [] args){
int ray [][]= new int [4][4];
int k=1;
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
if (i==0 && j==0)
{
ray [i][j]= 0;
}
else if(i>=j)
{
ray [i][j]= k++;
}
}
}
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
System.out.print(ray [i][j] +" ");
}
System.out.println();
}
}
}
{
public static void main (String [] args){
int ray [][]= new int [4][4];
int k=1;
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
if (i==0 && j==0)
{
ray [i][j]= 0;
}
else if(i>=j)
{
ray [i][j]= k++;
}
}
}
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
System.out.print(ray [i][j] +" ");
}
System.out.println();
}
}
}
0 comments:
Posting Komentar