Solved programming problem

Solve Basic Equation Problem in C++.

Source code

#include <iostream>

using namespace std;

int main()

{

    int eq1,eq2;

    cout<<"Ans of X+Y = ? ";

    cin>>eq1;

   cout<<"Ans of X-Y = ? ";

    cin>>eq2;

    int ans_x= (eq1+eq2)/2;

    int ans_y= (eq1-eq2)/2;

    cout<<"Your X= "<<ans_x<<" Your Y= "<<ans_y<<endl;

    return 0;

}

Output

Ans of X+Y = ?15

Ans of X-Y = ?5

Your X= 10 Your Y= 5

 

Join the discussion

Add your comment