English 中文(简体)
消化数字检查
原标题:check for descending digits in integer
  • 时间:2010-10-03 22:21:47
  •  标签:
  • java

我将如何在愤怒中核对数字? 例如,如果用户进入98765个用户,我需要核实这一点,并且说数字正在下降,反之亦然。 我不能将愤怒转化为扼杀,时间没有限制。 奥赫,数字必须“推”;=0。

我知道,我需要把愤怒分开,但我不敢肯定。 请帮助!

问题回答

不要回答整个问题,而是认为:

num = 98765;
digit = num % 10;

该法典将做些什么? 你们如何能够利用这一手段来获取每位数位数?

我向你们颁发了这部法典(因为它是家事),但:

  1. Use the modulus operator to get n mod 10, which will give you the lowest digit.
  2. If that lowest digit is one above the previous lowest digit, continue the loop; else quit the loop and say that the number is not descending.
  3. Divide n by 10.
  4. Go to step 1.

寻找模块操作员。 这将使你从表面上获得最适当的价值。 一旦您,结果就会分出10个,重复。 你这样做时,将你所得出的价值与你最后一次拿走的价值相比较。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签