From 17e7a23a49520e1491275ef7e91cce2959ac0631 Mon Sep 17 00:00:00 2001 From: jonathoncontact Date: Mon, 31 Aug 2026 11:38:37 -0700 Subject: [PATCH] Fix: Divide by zero problem, close #61 --- main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5411e7a3..4ccc8568 100644 --- a/main.cpp +++ b/main.cpp @@ -16,7 +16,11 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; - cout << "Division: " << x / y << endl; + if(y == 0){ + cout << "Division: Dividing by 0 is Not a Number" << endl; + }else{ + cout << "Division: " << x / y << endl; + } cout << "Remainder: " << x % y << endl; cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl;