
-----------------------------------
lemoe
Tue Feb 07, 2012 9:03 pm

Checking individual digits in an integer
-----------------------------------
My Problem is...
I have to write a program that checks whether a number is the same when rotated 180 degrees. I don't need help with the coding, I would just like some assistance with understanding a command to do this. Is there a command that checks the character or digit at a specified location in an integer? eg.) What is the third digit of integer 1863? Thanks in advance.

I am using Turing 4.0.5.

-----------------------------------
mirhagk
Tue Feb 07, 2012 9:20 pm

RE:Checking individual digits in an integer
-----------------------------------
Well an easy way would be turning it into a string, and then indexing the string.

-----------------------------------
crossley7
Tue Feb 07, 2012 10:47 pm

RE:Checking individual digits in an integer
-----------------------------------
a way to do it without converting to a string is integer division then mod by 10.  Look up the commands div and mod and think about how exactly you could do that

-----------------------------------
lemoe
Wed Feb 08, 2012 7:37 am

RE:Checking individual digits in an integer
-----------------------------------
Thanks

-----------------------------------
mirhagk
Wed Feb 08, 2012 10:22 am

RE:Checking individual digits in an integer
-----------------------------------
crossley's way it probably the better one, but just wanted to let you know there was multiple ways.
