algorithm to print the digits in the correct order
- by Aga Waw
I've been trying to write an algorithm that will print separately the digits from an integer. I have to write it in Pseudocode. I know how to write an algorithm that reverse the digits.
digi(n):
while n != 0:
x = n % 10
n = n // 10
print (x)
But I don't know how to write an algorithm to print the digits in the correct order. f.eg. the input is integer 123467 and the output is: 1 2 3 4 6 7 The numbers will be input from the user, and we cannot convert them to a string. I just need help gettin started on writing algorithms. Thanks