# Print the first Digit of a Number using Python

Get a number and print its First Digit.

Sample Input 1:

Enter the number: 234

Sample Output 1:

2 is the first digit of 234

#### Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#write your code here

#### Program or Solution

```
```
num = int(input("enter a number"))

n = num

while n > 10:

n = n // 10

print("{} is the first digit of {}".format(n,num))

#### Program Explanation

divide the number by 10 till number is greater than 10, once it is less than 10 then print the number. you will get the first digit.

#### Comments

#### Related Programs

- Count the number of digits in a Number in Python
- Find given number is a digit in a number using Python
- Count the Number of Occurrences of digit in a number using Python
- Sum of Digits of the number using Python
- Product of Digits of the number using Python
- Reverse the digits of a number using Python
- Find a number is Armstrong number or not using Python

coming Soon

coming Soon