In addition to Laserlight you can also type cast in the first program to get the correct answer.
ex.)
printf ("The value of d is %d\n", (int)d);