不分别赋值怎么输出呢?
这个怎么输出呢?每个“three”都不一样的值,每次需要给赋值到一个变量中吗?如果不赋值最后要怎样才能把那几个数值全部输出呢?
这个怎么输出呢?每个“three”都不一样的值,每次需要给赋值到一个变量中吗?如果不赋值最后要怎样才能把那几个数值全部输出呢?
2016-09-22
public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = 0 ;
three=one+two;
System.out.println(three);
three+=one;
System.out.println(three);
three-=one;
System.out.println(three);
three*=one;
System.out.println(three);
three/=one;
System.out.println(three);
three%=one;
System.out.println(three);
}
}
//每个“three”都不一样的值,每次需要给赋值到一个变量中吗?
//只有一个变量,名字叫所three。每次变化后输出即可!!!
public class Fanch {
public static void main(String[] args){
int one=10;
int two=20;
int three=0;
int t1=three=one+two;
int t2=three+=one;
int t3=three-=one;
int t4=three*=one;
int t5=three/=one;
int t6=three%=one;
System.out.println(t1);
System.out.println(t2);
System.out.println(t3);
System.out.println(t4);
System.out.println(t5);
System.out.println(t6);
我是这样的,也对的,但是觉得有点麻烦。还是一楼分别赋值输出好用
举报