diff --git a/main.cpp b/main.cpp old mode 100644 new mode 100755 index a495fc94..f2117ec1 --- a/main.cpp +++ b/main.cpp @@ -12,8 +12,8 @@ int main() std::cout << "Addition: " << x + y << std::endl; std::cout << "Subtraction: " << x - y << std::endl; std::cout << "Multiplication: " << x * y << std::endl; - std::cout << "Division: " << x / y << std::endl; - std::cout << "Remainder: " << x % y << std::endl; + y != 0 ? std::cout << "Division: " << x / y << std::endl : std::cout << "Dividing by zero is not a number." << std::endl; + if (y != 0) std::cout << "Remainder: " << x % y << std::endl; std::cout << "Square Root: " << sqrt(x) << std::endl; std::cout << "Square: " << pow(x, y) << std::endl;