-->
当前位置:首页 > 题库

PROGRAMMING:Decimal Equivalent

Luz5年前 (2021-05-10)题库603
Input an integer and print its decimal equivalent. [Hint: Use the remainder and
division operators to pick off the denary number’s digits one at a time from right to left. In
the decimal number system, in which the rightmost digit has a positional value of 1, and the next
digit left has a positional value of 10, then 100, then 1000, and so on.
Thus the decimal number 234 can be interpreted as $$4*1+3*10+2*100$$ .
### Input Specification:
a denary integer number.
### Output Specification:
print in a line the equivalent of the number..
### Sample Input 1:
```in
one hundred and twenty-three
```
### Sample Output 1:
```out
123 = 3 * 1 + 2 * 10 + 1 * 100
```
### Sample Input 2:
```in
one thousand five hundred and twenty-four
```
### Sample Output 2:
```out
1524 = 4 * 1 + 2 * 10 + 5 * 100 + 1 * 1000
```







answer:If there is no answer, please comment