[ create a new paste ] login | about

Link: http://codepad.org/iWSRSsUn    [ raw code | output | fork ]

cms - C, pasted on Dec 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<stdio.h>

int add(int x, int y) {
    int a, b;
    do {
        a = x & y;
        b = x ^ y;
        x = a << 1;
        y = b;
    } while (a);
    return b;
}


int main( void ){
    printf( "6 - 3 = %d", add(6,-3));
    return 0;
}


Output:
1
6 - 3 = 3


Create a new paste based on this one


Comments: