The variable should be assigned the value 600851475143, but none of the C data types is appropriate. What to do?
|
3 answers
Nobody canceled 64-bit numbers, @ Ivan Kushchev :
#include <stdio.h> int main() { long long i = 600851475143LL; printf("%lld\n", i); return 0; } - c90 does not guarantee the availability of
long long. This may be important if the old version of Visual Studio on Windows is used, which poorly supports c99, which guaranteeslong longand that its size is at least 64-bit (you can try "% I64" and__int64in this case). - jfs
|
Use another compiler that has 64-bit data types. Or the keys of the existing one.
|
Or use two variables, in one store n most significant digits, and in the other - Nn digits, where N is the total number of digits of the number.
|