>>451
printfの書式指定の中で %d とやっているが、これは int用の指定。
unsigned用にするには %uとしなければならない。

そしてunsignedなんだから、0でなければ必ず正。