I can never understand how to print unsigned long datatype in C.
unsigned long
Suppose unsigned_foo is an unsigned long, then I try:
unsigned_foo
The correct specifier for unsigned long is %lu.
%lu
If you are not getting the exact value you are expecting then there may be some problems in your code.
Please copy your code here. Then maybe someone can tell you better what the problem is.