As @rici points out, the problem is with the var
assignment.
// long long var=1234567890123456;
long long var=1234567890123456LL; // append LL
printf("%lld",var);
1234567890123456
was too large for int
and unsigned
in OP environment. To specify higher values, use the desire suffix.
I suspect 1015724736
was printed out by the OP originally as 1234567890123456 % 4294967296. 4294967296 being the assumed range of of OP's unsigned
( 0 to 4294967295).