Saturday, July 8, 2017

uva problem solution 10469 - To Carry or not to Carry


problem link:

Discuss:  In this problem we just have to do binary AND operation between two digit.and then we get desired value.

try yourself before see the code.



#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,d;
    while(cin >>n>>m)
    {
        d=n^m;
        cout <<d<<endl;
    }
    return 0;
}

No comments:

Post a Comment