Sample Program Reversing Integer Value
Because of slipshod work on the problems to be wrong. Today've just finished a course UAS algorithms and programming. There is a question that addresses the problem of reversing an integer value. Overnight taste already going out, but instead was not made. And it turns out real. Finally, not 100%, as pressed for time as well.
Now we will discuss the reverse problem. To our wasteful process like this:
r = r * 10 + n % 10
n = n / 10
r = save return value
n = integer number is entered
r = r * 10 + n % 10 will take the components one by one number, to do so it will be using a loop. n = n / 10 as a boundary loop.
Functions can be created like this:
Can be tried for the full program. Download HERE.
Now we will discuss the reverse problem. To our wasteful process like this:
r = r * 10 + n % 10
n = n / 10
r = save return value
n = integer number is entered
r = r * 10 + n % 10 will take the components one by one number, to do so it will be using a loop. n = n / 10 as a boundary loop.
Functions can be created like this:
Can be tried for the full program. Download HERE.
Jadilah yang pertama mengomentari
Post a Comment