From 555a8e1f965e85dd7c808272215ba9b90526e021 Mon Sep 17 00:00:00 2001 From: niranjan Date: Sat, 31 Oct 2026 10:14:03 +0530 Subject: [PATCH] Add simple calculator functions --- simple_calculator.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 simple_calculator.py diff --git a/simple_calculator.py b/simple_calculator.py new file mode 100644 index 000000000000..153ca2e6bc98 --- /dev/null +++ b/simple_calculator.py @@ -0,0 +1,21 @@ + +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 "Cannot divide by zero" + return a / b + + +if __name__ == "__main__": + print("Addition:", add(10, 5)) + print("Subtraction:", subtract(10, 5)) + print("Multiplication:", multiply(10, 5)) + print("Division:", divide(10, 5))