Okay, the problem is that (123456790 * 123456789) /2 is an integer expression. This overflows. The overflowed value is then used to initialize the long long T.
To fix it, you have to ensure that the right side uses long long arithmetic. You can do this by forcing the first item to be a long long: longlongint T = (123456790LL / 2 ) * 123456789;
The long long problem and my question about the constants would both go away if you let the compiler do all the arithmetic. This would also make it much easier to read:
1 2
constlonglong N = 123456789;
longlongint T = N * (N+1) / 2;