Computer Science, asked by jaipal6642, 11 months ago

write a program for harry has developed a new interest in learning numerology so starts paying attention to the numbers that comes up as he goes about his daily routine the program should get the input from the user & display the individual digits separated by a single space.assume input is less than 1000000000​

Answers

Answered by mad210219
1

PROGRAM

Explanation:

Python:

Num=int(input())

Ans=””

While(Num >0):

       S=Num%10

       Ans+=S

       Num=Num/10

for I in range(len(Ans)):

     print(I,end=” “)

         

we calculated everytime the each digit

by taking remainder when it is divided by 10

and we add the digit to a string

string+=digit

after all the digits are added to the string

print the character of string seerated by space

print(I,end=” “)

end=” “

indicates that the element that is printed automatically leaves some space and then the next variable is printed

we can use any end specifier like \n for new line

EXAMPLE:

1234

4 3 2 1 is the output

2)

43765

4 3 7 6 5

3)

942367

9 4 2 3 6 7

4) 98341256

9 8 3 4 1 2 5 6

As output

Each digit separated by space

Similar questions