Kapitel 10, 11 och 12

This commit is contained in:
2024-02-03 20:59:42 +01:00
parent accdeca47b
commit dfe6ba8c30
7 changed files with 166 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#!/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)))