Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- // } Driver Code Ends
- //User function Template for C++
- void reverse_dig(int &a,int &b)
- {
- //Add your code here.
- int x=0,y=0;
- while(a!=0){
- x = x*10 + (a%10);
- a/=10;
- }
- while(b!=0){
- y = y*10 + (b%10);
- b/=10;
- }
- a= x;
- b = y;
- return;
- }
- void swap(int &a,int &b)
- {
- int c;
- c = a;
- a = b;
- b=c;
- return;
- //Add your code here.
- }
- // { Driver Code Starts.
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- int a, b;
- cin>>a>>b;
- reverse_dig(a,b);
- swap(a,b);
- cout<<a<<" "<<b<<endl;
- }
- return 0;
- } //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement