From 101648abd80e954e10f2a877727ac9530701639f Mon Sep 17 00:00:00 2001 From: Pavankumar Date: Mon, 3 Nov 2025 08:05:20 +0530 Subject: [PATCH] Implement basic arithmetic operations in calculator --- SimpleCalculator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 SimpleCalculator.py diff --git a/SimpleCalculator.py b/SimpleCalculator.py new file mode 100644 index 0000000000..6bc1444f6c --- /dev/null +++ b/SimpleCalculator.py @@ -0,0 +1,19 @@ +def add(a, b): + return a + b + +def subtract(a, b): + return a - b + +def multiply(a, b): + return a * b + +def divide(a, b): + if b == 0: + return "Error! Division by zero." + return a / b + +print("Simple Calculator") +print("Addition:", add(5, 3)) +print("Subtraction:", subtract(5, 3)) +print("Multiplication:", multiply(5, 3)) +print("Division:", divide(5, 3))