D
dmpk2k
Forgive me if this is obvious to you. I feel somewhat foolish.
I've scribbled together something that demonstrates my problem. It takes the
product of all integers n squared, where n is 1..10.
-----------------
int main() {
int i;
unsigned long long product = 1;
for (i=1; i<=10; i++) product *= i * i;
printf("%U\n", product);
return 0;
}
-----------------
Would someone care to inform me why the output is 4114677760 and not
13168189440000? sizeof() tells me that I'm getting a 64-bit variable, so
what's going on? Is it an issue with printf()? And how do I resolve this?
Thanks,
dmpk2k
I've scribbled together something that demonstrates my problem. It takes the
product of all integers n squared, where n is 1..10.
-----------------
int main() {
int i;
unsigned long long product = 1;
for (i=1; i<=10; i++) product *= i * i;
printf("%U\n", product);
return 0;
}
-----------------
Would someone care to inform me why the output is 4114677760 and not
13168189440000? sizeof() tells me that I'm getting a 64-bit variable, so
what's going on? Is it an issue with printf()? And how do I resolve this?
Thanks,
dmpk2k