Find the values of X and Y in the Given Equations | CPP program to find the values of X and Y using the given equations ; Function to find the values of X and Y ; base condition ; required answer ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findValues ( int a , int b ) { if ( ( a - b ) % 2 == 1 ) { cout << " - 1" ; return ; } cout << ( a - b ) / 2 << " ▁ " << ( a + b ) / 2 ; } int main ( ) { int a = 12 , b = 8 ; findValues ( a , b ) ; return 0 ; }