
-----------------------------------
jhdho0204
Thu Dec 09, 2010 6:06 pm

Could anyone help please?
-----------------------------------
What is it you are trying to achieve?

Let n be a positive integer consisting of the digits dk?d1d0. Write a program that reads in a value of n and then prints its digits in a column, start with d0. Fro example if n = 3467, then the program should print

7

6

4

3


What is the problem you are having?



Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using

This is the question i got a problem with.. could someone help?

-----------------------------------
Tony
Thu Dec 09, 2010 6:14 pm

RE:Could anyone help please?
-----------------------------------
What kind of a problem do you have with this question?

-----------------------------------
jhdho0204
Fri Dec 10, 2010 9:57 am

RE:Could anyone help please?
-----------------------------------
I have problem with coding.. I'm not sure... could someone type in a code for me or something?

-----------------------------------
Insectoid
Fri Dec 10, 2010 10:31 am

RE:Could anyone help please?
-----------------------------------
Of course you're having a problem with your coding. If you were having issues with your breakfast, you wouldn't be here would you?

We're not writing even a single line for you though.

-----------------------------------
Tony
Fri Dec 10, 2010 12:38 pm

RE:Could anyone help please?
-----------------------------------
@jhdho0204: I'm sure that you are able to solve this question. If n=1234, describe, step by step, how you would get the answer.

-----------------------------------
jhdho0204
Fri Dec 10, 2010 6:37 pm

RE:Could anyone help please?
-----------------------------------
Well my code is:
var n: int

put "Type in an integer: "..
get n

for 1.. n
n mod 2= 1
put n
end for

-----------------------------------
Insectoid
Fri Dec 10, 2010 6:50 pm

RE:Could anyone help please?
-----------------------------------
n mod 2  = 1

You're not even trying. This doesn't do anything. I'm not sure if this will even compile.

Mathematically, how do you get the least significant digit in a number? The second least? Once you figure that out, it's a walk in the park to output it.

Here's a hint: You CAN (and probably should) use modulus.

-----------------------------------
Searing
Tue Dec 14, 2010 10:34 am

Re: Could anyone help please?
-----------------------------------
Or you could get the number as a string instead of an integer.

var num: string 

Then use string operations to get the result you want.
