-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution10.py
More file actions
25 lines (20 loc) · 676 Bytes
/
Copy pathsolution10.py
File metadata and controls
25 lines (20 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""ex.10
Create a program that prints the last digit of a given integer
Create a program that:
1) Reads the integer
2) Prints the last digit
Warning! Do not use the programming language MAGIC. After you complete the exercise feel free to do so.
Warning! Don't try to convert the number into string etc.
Warning! For this problem it's ok after spending some time to look for the solution."""
number = int(input("enter any integer: "))
if number in range(0, 9):
print (number)
elif number > 9:
while number >9:
number = number - 10
print (number)
else:
while number <-10:
number = number + 10
number *= -1
print (number)