unsigned int nBolum = 0; unsigned long nKalan = 0L; unsigned long ulA = 0L; unsigned long ulB = 0L; ... printf("ulA=%u\n",ulA); printf("ulB=%u\n",ulB); nBolum = (unsigned int) ulA/ulB; nKalan = (unsigned long) (ulA%ulB); printf("nBolum = %u\n",nBolum); printf("nKalan = %u\n",nKalan); ...
ulA=2607503366 ulB=16777215 nBolum = 155 nKalan = 7100321
to the screen.
But the nKalan value(the remaining value from the division) must be 7035041. why is it calculating it wrong?
what is the problem?