1 package test;
 2 
 3 //指定一个int数 在一行中打印这个数的所有因数 用空格隔开。
 4 
 5 
 6 
 7 public class test2 {
 8     public static void main(String args[]) {
 9 
10         int i = 100;
11         for (int j = 1; j <= 100; j++) {
12 
13             if (i % j == 0)
14                 System.out.println(j + " ");
15 
16         }
17 
18     }
19 
20 }



第二种写法
 1 package test;
 2 
 3 public class test3 {
 4     public static void main(String args[]){
 5         int i=100;
 6         int j=1;
 7     while(i%j==0)
 8     {         
 9      System.out.print(j+" ");
10      j++;
11     }
12 
13   }
14 }

但是这两种好像都不是很对,等我取经回来再改!

第二个要实现的“//打印一个9*9的正方形,用#号填充”,先记下