今日对一些简单的代码进行练习
1、乘法口诀表:
1、public class chengfakoujue
2、 publicstaticvoidmain(String[] args) {
3、 for(inti=1;i<=9;i++) {
//控制行数
4、 for(intk=1;k<=i;k++) {
//控制每行的列数
5、System.out.print(k+"*"+i+"="+(i*k)+"\t");
}
6、System.out.println();
}
}
}
do/while—break; 一般不使用do…while(true)一般用于至少需要执行一次的场景
for循环
**public class for xuhuan{
public static void main (String[] args) {
int res=0;
int k=1