Hướng dẫn how to print first digit of a number in python - cách in chữ số đầu tiên của một số trong python

Ở đây, chúng tôi sẽ thảo luận về cách có được chữ số đầu tiên của một số trong Python. Nếu số đó là 12345, thì hãy in chữ số đầu tiên 1 1. Chúng tôi sẽ phát triển một chương trình Python để có được chữ số đầu tiên của số đã cho bằng các phương thức gốc, chức năng tích hợp, toán tử [] và toán tử lát cắt.

Chúng tôi sẽ lấy một số trong khi khai báo biến. Sau đó, chúng tôi sẽ chạy vòng lặp trong khi tìm chữ số đầu tiên của một số chúng tôi chia số đã cho cho đến 10 cho đến khi số lớn hơn 10. Cuối cùng, chúng tôi còn lại với chữ số đầu tiên. Cuối cùng, chữ số đầu tiên của số sẽ được hiển thị trên màn hình.while loop to find the first digit of a number we divide the given number by 10 until the number is greater than 10. In the end, we are left with the first digit. Finally, the first digit of the number will be displayed on the screen.

# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# get the first digit
while [num >= 10]:
    num = num // 10

# printing first digit of number
print['The first digit of number:', num]

Output:-

Nhập bất kỳ số nào: 123 Chữ số đầu tiên của số: 1
The first digit of number: 1

Nhận chữ số đầu tiên bằng cách sử dụng các chức năng tích hợp

Chúng tôi đang sử dụng các chức năng tích hợp được gọi là Math.pow và Log10. Phương thức Math.Pow [] là phương thức thư viện của mô -đun toán học, nó được sử dụng để tính công suất đã cho của một cơ sở, nó chấp nhận hai số và trả lại số thứ nhất cho công suất của số thứ hai trong phao. log10 [] là một hàm toán học có trong tệp tiêu đề toán học. Nó trả về giá trị cơ sở nhật ký 10 của tham số truyền cho hàm log10 [].math.pow and log10. math.pow[ ] method is a library method of the math module, it is used to calculate the given power of a base, it accepts two numbers and returns the first number to the power of the second number in the float. log10[ ] is a mathematical function present in math.h header file. It returns the log base 10 value of the passed parameter to log10[] function.

# Python Program to get the first digit of number

# importing math module
import math

# take input
num = int[input['Enter any Number: ']]

# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]

# printing first digit of number
print['The first digit of number:', first_digit]

Output:-

Nhập bất kỳ số nào: 523 Chữ số đầu tiên của số: 5
The first digit of number: 5

Làm thế nào để có được chữ số đầu tiên của một số trong Python

Trong Python, chuỗi cung cấp toán tử [] để truy cập bất kỳ ký tự nào trong chuỗi theo vị trí chỉ mục. Chúng ta cần vượt qua vị trí chỉ mục trong dấu ngoặc vuông và nó sẽ trả về ký tự ở chỉ mục đó. Khi việc lập chỉ mục các ký tự trong một chuỗi bắt đầu từ 0, vì vậy để có được ký tự đầu tiên của chuỗi đã cho, hãy vượt qua vị trí chỉ mục 0 trong toán tử [].[ ] operator to access any character in the string by index position. We need to pass the index position in the square brackets, and it will return the character at that index. As indexing of characters in a string starts from 0, So to get the first character of the given string pass the index position 0 in the [ ] operator.

# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]

Output:-

Nhập bất kỳ số nào: 7983516 chữ số đầu tiên của số: 7
The first digit of number: 7

Nhận chữ số đầu tiên của số trong Python bằng cách sử dụng cắt lát

Chúng tôi sẽ nhận được ký tự đầu tiên của chuỗi bằng toán tử lát cắt. [: 1] chỉ định ký tự tại chỉ mục 0. Chuỗi [: 1] chỉ định các ký tự đầu tiên của chuỗi đã cho.slice operator. The [:1] specifies the character at index 0. The string[:1] specifies the first characters of the given string.

# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[:1]

# printing first digit of number
print['The first digit of number:', first_digit]

Output:-

Nhập bất kỳ số nào: 100 chữ số đầu tiên của số: 1
The first digit of number: 1

Q] Viết một chương trình để in chữ số tại một nơi của một số nhất định trong Python..

num = 543169

while [num >= 10]:
   num = num // 10

print[num]

Đầu ra:- 5

Nhận ghi chú để làm cho quá trình học tập của bạn dễ dàng. Chúng được thiết kế đặc biệt cho những người mới bắt đầu muốn học mã hóa thông qua các từ, chương trình và ví dụ đơn giản. Bạn có thể sử dụng nó làm tài liệu tham khảo và cho mục đích sửa đổi.

Ghi chú có sẵn:- Python, Java, C/C ++, DSA, SQL, HTML CSS JavaScript, v.v.

Nếu bạn thích bài đăng này, hãy chia sẻ nó với bạn bè của bạn. Bạn có muốn chia sẻ thêm thông tin về chủ đề được thảo luận ở trên hay bạn tìm thấy điều gì không chính xác? Hãy cho chúng tôi biết trong các ý kiến. Cảm ơn bạn!

# Python Program to get the first digit of number

# importing math module
import math

# take input
num = int[input['Enter any Number: ']]

# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]

# printing first digit of number
print['The first digit of number:', first_digit]
5
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
11
Input : 12345 
Output : First digit: 1
         last digit : 5

Input : 98562
Output : First digit: 9
         last digit : 2
17
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
11
Input : 12345 
Output : First digit: 1
         last digit : 5

Input : 98562
Output : First digit: 9
         last digit : 2
19
Input : 12345 
Output : First digit: 1
         last digit : 5

Input : 98562
Output : First digit: 9
         last digit : 2
11
Input : 12345 
Output : First digit: 1
         last digit : 5

Input : 98562
Output : First digit: 9
         last digit : 2
21

# Python Program to get the first digit of number

# importing math module
import math

# take input
num = int[input['Enter any Number: ']]

# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]

# printing first digit of number
print['The first digit of number:', first_digit]
5
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
1
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
11using2

# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
09
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
5
# Python Program to get the first digit of number

# take input
num = int[input['Enter any Number: ']]

# convert int to string
num_str = str[num]

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print['The first digit of number:', first_digit]
11#include 8

  • # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    16
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
  • # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    40
  • # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    17
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    19
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11using2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    16
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
    Examples: 
     

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    40modulo operator %. When modulo divided by 10 returns its last digit. 
    Suppose if n = 1234 
    then last Digit = n % 10 => 4 
    To find first digit of a number is little expensive than last digit. To find first digit of a number we divide the given number by 10 until number is greater than 10. At the end we are left with the first digit.
     

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    41
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    43
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    45

    C++

    JavaScript

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    56

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    66

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    69

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    9

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    0
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    6

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    Java

    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    8
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    9

    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    8
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    1

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    3
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6 #include 6#include 7#include 8

    #include 9using0#include 7using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1 namespace9#include 7std;1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7 std;7 std;8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    03
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    07
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    10

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    Python3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    15

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    18
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19 #include 7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    26 #include 7using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    32

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    38 #include 7#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    46
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    51

    C#

    using

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    3
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6 #include 6#include 7#include 8

    #include 9

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    9

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1 namespace9#include 7std;1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7 std;7 std;8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    03
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    01
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    10

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    15

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    08

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    18
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19 #include 7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    26 #include 7using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    32

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    38 #include 7#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    46
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1#include 8

    using

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    47
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    44
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    51using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    7

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6 #include 6#include 7#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1 namespace9#include 7std;1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7 std;7 std;8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    79
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    80

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    82
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    10

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    86

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    03
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2
    O[log10n]
    Auxiliary Space: O[1] 

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    15

    C++

    #include

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    18
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19 #include 7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    26 #include 7using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    32

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    06
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    07
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    08

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    38 #include 7#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    0
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    79
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    Java

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    46
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1#include 8

    using

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    7

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    57
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    59#include 7
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    61

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1 namespace9#include 7std;1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7 std;7 std;8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    03
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    95

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    15

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    Python3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    18
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19 #include 7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    15

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    6
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    18
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19 #include 7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    26 #include 7using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    14
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    34

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    38 #include 7#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    23
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04using2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    46
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    19
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    45
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    51

    C#

    using

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    3
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    40

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    98____1010
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    61

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    04
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    57
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    67

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    2
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    7 std;7
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    94

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    0
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[:1]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    8
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    97

    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    98
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    10

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    PHP

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    08

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    12
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11std;1

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    17
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    19
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    21

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11using2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11#include 8

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    16
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    37

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    40

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    41
    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    43
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    45

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    47
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    11
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    49
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    51using2

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    52

    JavaScript

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    53

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    56

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    4

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    58

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    60

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    2

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    09
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    66

    # Python Program to get the first digit of number
    
    # importing math module
    import math
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # get the first digit
    digits = int[math.log10[num]]
    first_digit = int[num / pow[10, digits]]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    5
    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    1
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    69

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    3

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    80

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    72
    num = 543169
    
    while [num >= 10]:
       num = num // 10
    
    print[num]
    1#include 8

    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    75
    Input : 12345 
    Output : First digit: 1
             last digit : 5
    
    Input : 98562
    Output : First digit: 9
             last digit : 2
    76#include 8

    # Python Program to get the first digit of number
    
    # take input
    num = int[input['Enter any Number: ']]
    
    # convert int to string
    num_str = str[num]
    
    # get the first digit
    first_digit = num_str[0]
    
    # printing first digit of number
    print['The first digit of number:', first_digit]
    86

    Độ phức tạp về thời gian: O [1] Không gian phụ trợ: O [1]O[1]
    Auxiliary Space: O[1]

    Lưu ý quan trọng: log10 [] là một hàm toán học có trong tệp tiêu đề toán học.h. Nó trả về giá trị cơ sở log 10 của tham số truyền cho hàm log10 []. & Nbsp;log10[] is a mathematical function present in math.h header file. It returns log base 10 value of the passed parameter to log10[] function. 


    Làm thế nào để bạn in chữ số đầu tiên và cuối cùng của một số trong Python?

    print ["Nhập một số:", end = ""] thử: num = int [input []] đếm = 0 trong khi num! = 0: if Count == 0: last = num % 10 đếm = đếm + 1 rem= num % 10 num = int [num / 10] in ["\ nfirst Digit [", rem, "] + chữ số cuối cùng [", cuối cùngĐầu vào!"]print["\nFirst Digit [", rem, "] + Last Digit [", last, "] =", rem + last] except ValueError: print["\nInvalid Input!"]

    Làm thế nào để bạn in các chữ số của một số trong Python?

    In từng chữ số của một số nhất định..
    n=int[input[]].
    s=str[n].
    cho tôi trong s:.
    print[i].

    Làm thế nào để bạn có được chữ số đầu tiên của một số hai chữ số trong Python?

    Để có được hai chữ số đầu tiên của một số: sử dụng lớp str [] để chuyển đổi số thành chuỗi. Sử dụng chuỗi cắt để chọn 2 ký tự đầu tiên của chuỗi..Use the str[] class to convert the number to a string. Use string slicing to select the first 2 characters of the string. Use the int[] class to convert the result to an integer.

    Làm thế nào để bạn cô lập một chữ số trong Python?

    2 cách dễ dàng để trích xuất các chữ số từ chuỗi Python..
    Sử dụng hàm isDigit [] để trích xuất các chữ số từ chuỗi python.Python cung cấp cho chúng tôi chuỗi.....
    Sử dụng thư viện Regex để trích xuất các chữ số ..

    Bài Viết Liên Quan

    Chủ Đề