given a four digit number N as input. write a program to print first and last digit of the number
num = int(input("Input number N: "))
last = num % 10
while (num > 10):
num = num // 10
first = num % 10
print(f'\nFirst digit: {first} \nLast digit: {last}')
Comments
Leave a comment