Computer Science, asked by nitushn5, 10 months ago

Write a Python function, that takes a positive integer and returns the one’s position digit of the integer.

Answers

Answered by sakud24
14

Answer:

def pos1(n):

   if n>0:

       return int(str(n)[-1])

   else:

       print('please enter a non-zero positive integer')

a=int(input('enter a positive number:'))

print(pos1(a))

------------------------------

Hope it was helpful

Answered by Rameshjangid
0

Answer:- You are told to write a function that takes a positive integer and return the one's position digit of the integer. The function is as follows:-

def number (x):

   one = x % 10

   return one

The output of this program will be:-

Suppose if I put the value number as = 12356

The output will be: 6

i.e., the one's place digit of the number we enter.

OR

x = int ( input( ) )

print(x % 10)

Suppose that you entered the number = 23.

And then you are going to gain its ones digit i.e., 3.

You need to know that this is only valid for the numbers that are bigger than 10.

Therefore , you got your one's digit.

The code is:-

x = int ( input( ) )

y = x % 10

print(y)

Hope these answers are helpful.

To know more about the given topic please go through the following

Link1:- https://brainly.in/question/18739060?

Link2:- https://brainly.in/question/19927073?

#SPJ6

Similar questions