//下面这个语句我想让它输出t为1+2/1+3/1......+20/1,它为啥输出为“t的值为1‘’?
public class hellojava {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int c,x,t;
c=0;
x=0;
t=0;
while(x<=20){
x=x+1;
c=1/x;
t=c+t;
}
System.out.println("t等于"+t);
}
}
public class hellojava {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int c,x,t;
c=0;
x=0;
t=0;
while(x<=20){
x=x+1;
c=1/x;
t=c+t;
}
System.out.println("t等于"+t);
}
}