Initial commit
This commit is contained in:
15
sidan_185_ex1.py
Normal file
15
sidan_185_ex1.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import math
|
||||
|
||||
try:
|
||||
t = int(input("Ange täljaren: "))
|
||||
n = int(input("Ange nämnaren: "))
|
||||
except ValueError:
|
||||
exit("Ange endast heltal")
|
||||
|
||||
sgd = math.gcd(t, n)
|
||||
|
||||
print ("SGD är:", str(sgd))
|
||||
print (str(t) + "/" + str(n), "=", \
|
||||
str(int(t/sgd)) + "/" + str(int(n/sgd)))
|
||||
Reference in New Issue
Block a user