1,2,3
4,5,6
7,8,8
轉
1,4,7
2,5,8
3,6,9
import java.util.*;
/*Please dont change class name, Dcoder
and class must not be public*/
//Compiler version JDK 1.8
class Dcoder
{
public static void main(String args[])
{
System.out.println("Hello, Dcoder!");
int num1[][]={
{1,2,3},
{4,5,6},
{7,8,9}};
int num2[][]={
{1,2,3},
{4,5,6},
{7,8,9}};
int a,b,c;
for(a=0;a<=2;a++)
{
for(b=0;b<=2;b++)
{
num2[b][a]=num1[a][b];
}
}
for(a=0;a<=2;a++)
{
for(b=0;b<=2;b++)
{
System.out.print(num2[a][b]+",");
}
System.out.println();
}
}
}
==========
Hello, Dcoder!
1,4,7,
2,5,8,
3,6,9,
全站熱搜
留言列表