*Author:* Anurag

*Tester:* Anurag

*Editorialist:* Anurag

# DIFFICULTY:

EASY,MEDIUM,GREEDY,STRING,CAKEWALK, SIMPLE

# PREREQUISITES:

Math ,String

# PROBLEM:

Swap two numbers numbers without using 3rd variable and then print the given number you have given two numbers if the sum of these two number is even then print numbers as it else print the number with swap

# EXPLANATION:

We have only given two numbers and we have to swap these number if the given numbers addition is even then we have to print these numbers as it is else we have to swap it

for example 2 3

sum of 2 and 3 is odd number else we have to swap it and print it hence output is 3 2

another example 2 4

the sum of 2 and 4 is even hence we have to print it as it hence output is 2 4

# SOLUTIONS:

## Setter's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

int t ;

cin>>t;

while(t–){

int n,m;

cin>>n>>m;

int sum=0;

sum=n+m;

if(sum%2==0){

cout<<n<<" “<<m;

}

else cout<<m<<” "<<n;

cout<<endl;

}

return 0;

}

## Tester's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

int t ;

cin>>t;

while(t–){

int n,m;

cin>>n>>m;

int sum=0;

sum=n+m;

if(sum%2==0){

cout<<n<<" “<<m;

}

else cout<<m<<” "<<n;

cout<<endl;

}

return 0;

}

## Editorialist's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

int t ;

cin>>t;

while(t–){

int n,m;

cin>>n>>m;

int sum=0;

sum=n+m;

if(sum%2==0){

cout<<n<<" “<<m;

}

else cout<<m<<” "<<n;

cout<<endl;

}

return 0;

}