Uploaded April 2021 | Updated November 2026, 5 days ago
Sent by a subscriber - see original task description below
Write an algorithm that takes a positive integer and performs a cyclical shift toward the right of its digits, the number of times specified by the user. The algorithm should ask the user a positive integer N and a number of times V (positive integer) to perform the bleed.
A cyclical shift to the right consists of shifting each digit of a number towards the right, occupying a less significant space. The least significant digit of all, is "cycled" and it ranks as the most significant.
For example, to cyclically shift the number 1234 to the right, the digit 4 changes to be the most significant while the rest move one space to the right, giving as Result 4123.
Regardless of the number of digits in the number, the result should be similar. For example, when apply a cyclical shift to the right on the number 6659712, the result is 2665971.
If the number provided has only one digit, the shift results in the same number.
As mentioned earlier, the algorithm also receives the number of times the
shift, then if V is equal to 4, this means that the shift must be applied 4 times
always on the previous result.
As a mandatory requirement, the algorithm must make use of the following subroutines:
- countDigits (N): this subroutine receives an integer number and returns an integer with the amount of digits of N.
--RightCycle shift (N): this subroutine receives an integer N and returns a number
An integer that is the result of making a single cyclical shift to the right in N.
Therefore, the main program must invoke the subroutine CyclicalRight repeated times according to the value of input V.
Sent by a subscriber - see original task description below
Write an algorithm that takes a positive integer and performs a cyclical shift toward the right of its digits, the number of times specified by the user. The algorithm should ask the user a positive integer N and a number of times V (positive integer) to perform the bleed.
A cyclical shift to the right consists of shifting each digit of a number towards the right, occupying a less significant space. The least significant digit of all, is "cycled" and it ranks as the most significant.
For example, to cyclically shift the number 1234 to the right, the digit 4 changes to be the most significant while the rest move one space to the right, giving as Result 4123.
Regardless of the number of digits in the number, the result should be similar. For example, when apply a cyclical shift to the right on the number 6659712, the result is 2665971.
If the number provided has only one digit, the shift results in the same number.
As mentioned earlier, the algorithm also receives the number of times the
shift, then if V is equal to 4, this means that the shift must be applied 4 times
always on the previous result.
As a mandatory requirement, the algorithm must make use of the following subroutines:
- countDigits (N): this subroutine receives an integer number and returns an integer with the amount of digits of N.
--RightCycle shift (N): this subroutine receives an integer N and returns a number
An integer that is the result of making a single cyclical shift to the right in N.
Therefore, the main program must invoke the subroutine CyclicalRight repeated times according to the value of input V.










