
陣列*2嘗試用手機Dcoder軟體寫
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},
{10,11,12}};
int num2[][]={
{1,2,3},
{4,5,6},
{7,8,9},
{10,11,12}};
int a,b;
for(a=0;a<=3;a++)
{
for(b=0;b<=2;b++)
{
num2[a][b]=num1[a][b]*2;
System.out.print(num2[a][b]+",");
}
System.out.println();
}
}
}
===========
Hello, Dcoder!
2,4,6,
8,10,12,
14,16,18,
20,22,24,
請先 登入 以發表留言。