From 03979be728c544bebd8aa8f1ecbf866b5c573dc3 Mon Sep 17 00:00:00 2001 From: Cameron Sweet Date: Mon, 8 Sep 2025 11:26:57 -0700 Subject: [PATCH] Fixed Divide 0 error, closes #61 --- main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.cpp b/main.cpp index 958ba61..994bc3f 100644 --- a/main.cpp +++ b/main.cpp @@ -15,8 +15,12 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; + if(y==0){ + cout << "Can't Divide by 0\n"; + }else { cout << "Division: " << x / y << endl; cout << "Remainder: " << x % y << endl; + } cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl;