java操作练习
//乘法口诀表
package YunSuanFu;
public class Xuexi {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int x = 1; x <= 9; x++)
{
for(int y = 1;y<=x;y++)
{
System.out.print(y+"*"+ x +"="+y*x+"\t");
}
System.out.print("\n");
}
}
}
//比大小,输出最小值
int a=1;
int b=2;
int c=3;
if(a<b&a<c){
System.out.println("输出最小值:"+a);
}else if(b<c&b<a){
System.out.println("输出最小值:"+b);
}else if(c<a&c<b){
System.out.println("输出最小值:"+c);
}
}
}
结果:最小值为1
//阶乘
int a = 0;
int b =1;
for(a=1;a<=10;a++){
b = b*a;
}
System.out.println(b);
结果为:3628800
//求和
int x = 0;
int y = 0;
for(x=1;x<=10;x++){
y = y+x;
}
System.out.println(y);
结果为:55