陣列*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,

創作者介紹
創作者 驢子的生活日記 的頭像
驢子

驢子的生活日記

驢子 發表在 痞客邦 留言(0) 人氣( 37 )