【发布时间】:2019-05-02 18:07:59
【问题描述】:
我有一些代码要获取,你们能帮我获取剩余的代码吗.....
public class SumOfGivenInt {
public static void main(String[] args) {
int num=6789123,lastvalue=0;
while(num>0){
int reminder=num%10;
int copy=reminder;
// I think here some code need to write........
System.out.println(reminder);
lastvalue=lastvalue*10+reminder;
num/=10;
}
}
}
我的想法是复制提醒并将该提醒与之前的值进行比较,然后我们将得到正确的答案。如何使用我的逻辑达到我的要求.......
【问题讨论】:
-
if(copy==copy-1) {永远不会是真的 -
您的问题不清楚。是否要从“6789123”中选择最大的数字。答案是 9 吗?
-
那我该怎么办。请给我建议。
-
有两种方法 1) 排序 nos 2) 使用 2 个变量。
-
如何添加代码sn-p