Umstellen der Auswertungslogik

This commit is contained in:
Oliver Hofmann
2026-03-30 13:09:16 +02:00
parent 228273f399
commit c48b5c7e59
42 changed files with 1690 additions and 1564 deletions
+6 -6
View File
@@ -1,13 +1,13 @@
from utils.memory_cell import MemoryCell
from utils.literal import Literal
from utils import AlgoContext, Int
x = MemoryCell(int(input("Erste Zahl: ")))
y = MemoryCell(int(input("Zweite Zahl: ")))
ctx = AlgoContext()
x = Int(int(input("Erste Zahl: ")), ctx)
y = Int(int(input("Zweite Zahl: ")), ctx)
while x > Literal(0):
while x > 0:
if x < y:
x, y = y, x
x -= y
print(y)
print(f"Insgesamt gab es {x.sub_count + y.sub_count} Subtraktionen.")
print(f"Insgesamt gab es {ctx.subtractions} Subtraktionen.")