bhadson2001 wrote: > unsigned char a; > a=255*20/10; > > it gives output 254 > > for > a=255*200/100; > > it gives output 111 > > why it gives different results. > > it there any logical relationship. > > kindly help me to resolve the problem. > i will be grateful > thanks a lot....... 255*20/10 -> 510 which overflows "unsigned char" (256). The remainder is 510 % 256 -> 254.
Message
Re: [AVR-Chat] C problem
2008-02-28 by Russell Shaw