I was trying to write a simple program on C about the classical history between the king, chessboard and rice grains. The total amount of rice grains that is needed to fill the chessboard is : 18 446 744 073 709 551 615 .
But i'm getting : 18 446 744 073 709 552 000. on C.
Aren't there any solution to increase 17 digits resolution? I saw some solutions which were very long and complicated where a newbie like me couldnt understand anything.
Here is my code:
Code:
#include<stdio.h>
#include<math.h>
int main(void)
{
double i=1.0;
while(i<=64)
{
printf("%2.0lf.Casilla = %.0lf\n", i, pow(2.0,(i-1.0)));
i++;
}
printf("\n\n***En Total = %.0lf Granos.\n\n",pow(2.0,64.0)-1);
return0;
}