只要满足条件 sumaA > sumaB,我就想运行“while”循环。如何显示 sumaA 和 sumaB 的迭代次数和当前值?
import java.util.*;
class Sum {
public static void main(String[] args) {
int sumaA = 1000;
int sumaB = 0;
Random rand = new Random();
int n = rand.nextInt(9);
int g = rand.nextInt(49);{
System.out.println("Random N= "+ n);
sumaA += n;
System.out.println("sumaA: "+sumaA);
System.out.println();
System.out.println("Random N= "+ g);
sumaB += g;
System.out.println("sumaB: "+sumaB);
while (sumaA>sumaB);
}
System.out.println("loop runs numbers");
System.out.println("value sumaA" + sumaA + "value sumaB " + sumaB);
}
}
交互式爱情
四季花海
UYOU
阿波罗的战车
相关分类