Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Kalkulator
- def sabiranje(broj1, broj2):
- return broj1 + broj2
- def oduzimanje(broj1, broj2):
- return broj1 - broj2
- def mnozenje(broj1, broj2):
- return broj1 * broj2
- def dijeljenje(broj1, broj2):
- return broj1 / broj2
- print("Izaberi operaciju -\n"
- "1. Sabiranje\n"
- "2. Oduzimanje\n"
- "3. Mnozenje\n"
- "4. Dijeljenje\n")
- izbor = int(input("Izaberi operaciju 1, 2, 3, 4 :"))
- broj1 = int(input("Izaberi prvi broj: "))
- broj2 = int(input("Izaberi drugi broj: "))
- if izbor == 1:
- print(broj1, "+", broj2, "=",
- sabiranje(broj1, broj2))
- elif izbor == 2:
- print(broj1, "-", broj2, "=",
- oduzimanje(broj1, broj2))
- elif izbor == 3:
- print(broj1, "*", broj2, "=",
- mnozenje(broj1, broj2))
- elif izbor == 4:
- print(broj1, "/", broj2, "=",
- dijeljenje(broj1, broj2))
- else:
- print("Pogresan unos")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement