一个for循环编写九九乘法表
public static void main(String[] args) {
for (int i = 1,j = 1; j <= 9; i++) {
System.out.print(i + "*" + j + "=" + i*j + " ");
/*if(i == 9) {
break;
}*/
if(i == j) {
System.out.println();
j++;
//System.out.println("j为:" + j);
i = 0;
//System.out.println("i为:" + i);
}
}
}
不用第三变量互换两个变量值问题
public static void main(String[] args) {
int a = 123;
int b = 25;
//利用加法运算互换
a = a + b;
b = a - b;
a = a - b;
System.out.println(a);
System.out.println(b);
}