Skip to content

Commit

Permalink
Fix NaN errors, resolves ChicoState#61
Browse files Browse the repository at this point in the history
  • Loading branch information
Mjmcfarlane committed Jan 31, 2024
1 parent 201e6f0 commit bf950fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ 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;

if(y != 0){
std::cout << "Division: " << x / y << std::endl;
std::cout << "Remainder: " <<x % y << std::endl;
} else {
std::cout << "Dividing by zero is not a number" << std::endl;
std::cout << "Remainder: " << x << std::endl;
}

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

Expand Down

0 comments on commit bf950fc

Please sign in to comment.