added tut05
This commit is contained in:
19
Tutorium/tut05/src/program.py
Normal file
19
Tutorium/tut05/src/program.py
Normal file
@ -0,0 +1,19 @@
|
||||
def multiply(a: int, b: int) -> int:
|
||||
x, y, p = a, b, 0
|
||||
while x > 0:
|
||||
p = p + y
|
||||
x = x - 1
|
||||
return p
|
||||
|
||||
|
||||
def run() -> None:
|
||||
while True:
|
||||
a = input("Bitte geben Sie eine Zahl oder exit ein:\n> ")
|
||||
if a == "exit":
|
||||
break
|
||||
b = input("Bitte geben Sie eine weitere Zahl ein:\n> ")
|
||||
print(f"{a} * {b} = {multiply(int(a), int(b))}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
Reference in New Issue
Block a user