Ở đâ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. Output:- Nhập bất kỳ số nào: 123 Chữ số đầu tiên của số: 1 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. Output:- Nhập bất kỳ số nào: 523 Chữ số đầu tiên của số: 5 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. Output:- Nhập bất kỳ số nào: 7983516 chữ số đầu tiên của số: 7 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. Output:- Nhập bất kỳ số nào: 100 chữ số đầu tiên của số: 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.. Đầ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
# 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]
The first digit of number: 1Nhận chữ số đầu tiên bằng cách sử dụng các chức năng tích hợp
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
The first digit of number:
5Làm thế nào để có được chữ số đầu tiên của một số trong Python
# 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]
The first digit of number: 7Nhận chữ số đầu tiên của số trong Python bằng cách sử dụng cắt lát
# 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]
The first digit of number: 1num = 543169
while [num >= 10]:
num = num // 10
print[num]
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]
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]
Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
17
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]
Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
19Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
11Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
21
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]
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# 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]
using
2
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# 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]
#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
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]
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]
Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
17
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]
Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
19Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
11Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
21
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]
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# 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]
using
2
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# 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]
#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]
37Examples:
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.
41 # 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]
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]
Input : 12345
Output : First digit: 1
last digit : 5
Input : 98562
Output : First digit: 9
last digit : 2
43
1num = 543169
while [num >= 10]:
num = num // 10
print[num]
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 : 266
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 : 269
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
5num = 543169
while [num >= 10]:
num = num // 10
print[num]
0num = 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]
8num = 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]
3Java
num = 543169
while [num >= 10]:
num = num // 10
print[num]
8 num = 543169
while [num >= 10]:
num = num // 10
print[num]
9num = 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 : 21
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 23
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 24
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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
9using
0#include
7using
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]
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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 namespace
9#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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
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]
04using
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]
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]
07num = 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]
3Python3
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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
7using
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]
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]
04using
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]
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]
51C#
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]
53Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 23
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 24
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 namespace
9#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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
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]
04using
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]
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]
01num = 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
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', 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]
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
7using
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]
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]
04using
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]
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
8using
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
51using
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]
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]
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', 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]
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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 namespace
9#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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
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]
82num = 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
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]
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]
using
2 O[log10n]
Auxiliary Space: O[1]
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]
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
7using
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]
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]
5num = 543169
while [num >= 10]:
num = num // 10
print[num]
0num = 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]
79num = 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]
04using
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]
3Java
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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
8using
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 namespace
9#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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
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]
04using
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]
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]
3Python3
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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
7using
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]
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]
04using
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]
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]
51C#
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]
53Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 23
# 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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____1010num = 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]
0num = 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 22
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 27
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]
8num = 543169
while [num >= 10]:
num = num // 10
print[num]
97num = 543169
while [num >= 10]:
num = num // 10
print[num]
98num = 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]
3PHP
# 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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 211
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 212
# 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 : 217
# 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 : 219
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 211
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 221
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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]
11using
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 # 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]
11Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 243
num = 543169
while [num >= 10]:
num = num // 10
print[num]
1Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 245
# 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]
11Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 249
# 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]
51using
2Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 252
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]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 258
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = int[math.log10[num]]
first_digit = int[num / pow[10, digits]]
# printing first digit of number
print['The first digit of number:', first_digit]
5Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 260
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 : 266
# Python Program to get the first digit of number
# importing math module
import math
# take input
num = int[input['Enter any Number: ']]
# get the first digit
digits = 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 : 269
# 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]
80Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 272
num = 543169
while [num >= 10]:
num = num // 10
print[num]
1#include
8Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 275
Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 276
#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.