Write a program in Java using For Loop statement that will produce the following output.
输出是:
1  2   3  4  
2  4   6  8
3  6   9  12
4  8   12 16

解决方案 »

  1.   


    public class Test14 {
    public static void main(String[] args){
    for(int i=1;i<5;i++){
    for(int j=1;j<5;j++){
    System.out.print(i*j+"\t");
    }
    System.out.println();
    }
    }}撒分贴
      

  2.   

    public class forLoop {
    public static void main(String[] args) { for(int i = 1; i < 5; i++){
    for(int j = i; j <= 4 * i; j += i){
    System.out.printf("%d  ",j);
    }
    System.out.println("");
    }

    }}
    嘿嘿,给分吧!
      

  3.   

    public class ForTest
    {
    public static void main(String[] args)
    {
    for(int i=1;i<5;i++)
    {
    for(int j=1;j<5;j++)
    {
    System.out.print(i*j+"\t");
    }
    System.out.print("\n");
    }
    }
    }
    用for循环嵌套,第一个for控制要打印的行数,第二个for循环控制要打印的列