Skip to content

Commit

Permalink
Division 0 error fixes ChicoState#61
Browse files Browse the repository at this point in the history
  • Loading branch information
sunami09 committed Feb 1, 2024
1 parent 3abccef commit e9b4529
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <iostream>
#include <cmath>

using namespace std;
int main()
{
cout << "This is Kevin!\n";
Expand All @@ -12,8 +12,10 @@ 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 ? cout << "Division: " << x / y << endl : cout << "Dividing by zero is not a number." << endl;
y != 0 ? cout << "Remainder: " <<x % y << endl : cout << "Dividing by zero is not a number." << endl;

std::cout << "Square Root: " << sqrt(x) << std::endl;
std::cout << "Square: " << pow(x, y) << std::endl;

Expand Down

0 comments on commit e9b4529

Please sign in to comment.