Go Down

Topic: How do I combine two single-digit numbers into one double-digit number? (Read 657 times) previous topic - next topic

joexusun

How do I combine two single-digit numbers into one double-digit number?

For example, I have "2" and "3" as two single-digit numbers, and I want to make a double digit number "23". All these three numbers are "int" type.

PaulS

Write them down on a piece of paper. Notice how you put one number in the ones column and the other number in the tens column.

Then, look up how to multiply one number by 10. It isn't rocket science.

joexusun

ehhh... That is right! I was thinking shift bits and that kind of stuff.. Thanks

Go Up