Untitled document
Untitled document
#include<cmath>
using namespace std;
//variable
int x; int y; //user inputs
int add, sub, mult, rem, power;
double divide;
int main()
{
cout << "Enter Value 1: ";
cin >> x;
cout << "Enter Value 2: ";
cin >> y;
cout << "Value1: " << x << "\nValue2: " << y << endl;
add = x + y;
sub = x - y;
mult = x * y;
divide = x / y;
power = (pow(x, 2) + pow(y, 2));
rem = x % y;
cout << "Addition = " << add << endl;
cout << "Subtraction = " << sub << endl;
if (sub < 0)
{
cout << "the result for subtraction is Negative" << endl;
}
else if (sub > 0)
{
cout << "the result for subtraction Positive" << endl;
}
else
{
cout << "the result for subtraction is 0" << endl;
}
cout << "Multiplication = " << mult << endl;
cout << "Division = " << divide << endl;
cout << "division with remainder = " << divide << ",with remainder " << rem << endl;
cout << "Power " << power<< endl;
if (power > 50 && sub > 0)
{
cout << "the solution for Equation 1 is greater than 50 ( " << power << " > 50 )
and the solution for Subtraction is Positive"<<endl;
}
else if (power > 50 && sub < 0)
{
cout << "The solution for Equation 1 is greater than 50 ( "<< power << "> 50 ) but
the solution for Subtraction is Negative" << endl;
}
else if (power < 50 && sub >0)
{
cout << "The solution for Equation 1 is less than 50 ( " << power << "< 50) but the
solution for Subtraction is Positive" << endl;
}
else
{
cout << "Neither conditions are true" << endl;
}
}