Skip to content

Commit

Permalink
Create main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
the29ster authored Feb 12, 2024
1 parent 7acc9ca commit db032a9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
#include <cmath>

int main()
{
cout<<"Hi, please enter two whole numbers: ";

int x,y;

std::cin >> x >> y;
std::cout << x << "+" << y << "=" << x + y << std::endl;
std::cout << x << "-" << y << "=" << x - y << std::endl;
std::cout << x << "*" << y << "=" << x * y << std::endl;

if(y == 0)
{
std::cout << "Dividing by zero is not a number." << std::endl;
}
else
{
std::cout << x << "/" << y << "=" << x / y << " with remainder of " << x % y << std::endl;
}

std::cout << "Square root of " << x << " is " << sqrt(x) << std::endl;
std::cout << "Square root of " << y << " is " << sqrt(y) << std::endl;
std::cout << x << "^" << y << "=" << pow(x, y) << std::endl;

return 0;
}

0 comments on commit db032a9

Please sign in to comment.