1 /** 2 * 3 * @author qsl 4 * 5 */ 6 public class ChengFaB { 7 public static void main(String[] args) { 8 DD(); 9 } 10 11 public static void FF() {//for...for 12 for (int i = 1; i < 10; i++) { 13 for (int j = 1; j <= i; j++) { 14 System.out.print(j + "*" + i + "=" + i * j + " "); 15 } 16 System.out.println(); 17 } 18 }
19 public static void FW() {//for...while 20 for (int i = 1; i < 10; i++) { 21 int j = 1; 22 while ( j <= i) { 23 System.out.print(j + "*" + i + "=" + i * j + " "); 24 j++; 25 } 26 System.out.println(); 27 } 28 }
29 public static void WW() {//while...while 30 int i = 1; 31 while ( i < 10 ) { 32 int j = 1; 33 while ( j <= i) { 34 System.out.print(j + "*" + i + "=" + i * j + " "); 35 j++; 36 } 37 System.out.println(); 38 i++; 39 } 40 } 41 42 public static void DW() {//do...while while 43 int i = 1; 44 do{ 45 int j = 1; 46 while ( j <= i) { 47 System.out.print(j + "*" + i + "=" + i * j + " "); 48 j++; 49 } 50 System.out.println(); 51 i++; 52 }while ( i < 10 ) ; 53 }
54 public static void DD() {//do...while do...while 55 int i = 1; 56 do{ 57 int j = 1; 58 do{ 59 System.out.print(j + "*" + i + "=" + i * j + " "); 60 j++; 61 }while ( j <= i) ; 62 System.out.println(); 63 i++; 64 }while ( i < 10 ) ; 65 } 66 }