I have been wondering the definition...
I mean,
Are both 00123 and 12345 five-digit numbers?

Recommended Answers

All 7 Replies

I have been wondering the definition...
I mean,
Are both 00123 and 12345 five-digit numbers?

Is a question with a trick?.

Yes, both are five-digit numbers. 00123 has a value of 123 units but is a
five-digit number.

Member Avatar for iamthwee

No this is a trick question. He's trying to trick us.

Sorry, i DIDN'T MEAN to trick you.

That's just one question...:-|

Member Avatar for iamthwee

Well, the only part where the definition might matter is if you intend to do some maths with it.

Do you?

Sorry, i DIDN'T MEAN to trick you.

That's just one question...:-|

Oh, don't feel bad :sad: . Sometimes we let our "sense of humor" get the
best part of us.

Cheers.

I have been wondering the definition...
I mean, Are both 00123 and 12345 five-digit numbers?

If talking in context of programming languages (C/C++), no. A number with leading 0 denotes an octal number the same way that a leading 0X denotes a hexadecimal number.

So in the end, when expressed in decimal format (base 10, normal numbers), 00123 stands for 83.

[tex]123_8 -> 1 * 8^2 + 2 * 8^1 + 3 * 8^0 = 83_1_0[/tex]

If talking in context of programming languages (C/C++), no. A number with leading 0 denotes an octal number the same way that a leading 0X denotes a hexadecimal number.

So in the end, when expressed in decimal format (base 10, normal numbers), 00123 stands for 83.

[tex]123_8 -> 1 * 8^2 + 2 * 8^1 + 3 * 8^0 = 83_1_0[/tex]

And that is correct

No this is a trick question. He's trying to trick us.

See iamthewee, you where correct all along. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.