# Write a Python program to receive a five-digit no and display as like 24689: 2 4 6 8 9

## Write  a Python program to receive a five-digit no and display as like 24689: 2 4 6 8 9

Given a five digit number , write a  program to receive a five-digit no and display as like 24689: 2 4 6 8 9 .

Sample input

`24986`

Sample output

`6 8 9 4 2`

## Write  a Python program to receive a five-digit no and display as like 24689: 2 4 6 8 9

The objective of the code is to print the digits of the number by space separated .

### Algorithm:

1. Take input a 5-digit number from the user.
2. Convert the number to string format using str() function.
3. Iterate through each character of the string using a for loop.
4. Print each character separated by a space.

Code(Python):-

num = input("Enter a five-digit number: ")
print(num + ":", end=" ")

for digit in num:
print(digit, end=" ")

Output:

Enter a five-digit number: 24986:
6 8 9 4 2

Explanation:

### Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-
iMocha coding Questions:-
Tech Mahindra coding questions:-
Unthinkable Solutions coding questions:-