Project "Numbers" (Tokens for displaying....)


#1

The project “Numbers” that i did gave me the following result:

#include <stdio.h>

int main(int argc, const char * argv[])
{

int x = 225;
printf("x is %d.\n", x);
printf("In octal, x is %o.\n", x);
printf("In hexadecimal, x is %x.\n", x);
return 0;

}

x is 225.
In octal, x is 341.
In hexadecimal, x is e1.

and in the book is:

x is 255
In octal, x is 377.
In hexadecimal, x is ff

Wich one is right?


#2

They’re both right (at least, so it looks without checking). You have 225, the book has 255.


#3

Thank you. I didn’t notice that i had put the wrong number :neutral_face: