[ create a new paste ] login | about

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

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

int add_ok( int x, int y ){
    int sum = x+y;
    printf("Sum is : %d\n", sum);
    return (sum-x==y) && (sum-y==x);
}

int main()
{
    if ( add_ok( INT_MAX, INT_MAX ) )
        printf("It is ok\n");
    else
        printf("It is NOT ok\n");
    return 0;
}


Output:
1
2
Sum is : -2
It is ok


Create a new paste based on this one


Comments: