Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Could anyone help please?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jhdho0204




PostPosted: Thu Dec 09, 2010 6:06 pm   Post subject: Could anyone help please?

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
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?
<Answer Here>


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
This is the question i got a problem with.. could someone help?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Dec 09, 2010 6:14 pm   Post subject: RE:Could anyone help please?

What kind of a problem do you have with this question?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jhdho0204




PostPosted: Fri Dec 10, 2010 9:57 am   Post subject: 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




PostPosted: Fri Dec 10, 2010 10:31 am   Post subject: 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




PostPosted: Fri Dec 10, 2010 12:38 pm   Post subject: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jhdho0204




PostPosted: Fri Dec 10, 2010 6:37 pm   Post subject: 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




PostPosted: Fri Dec 10, 2010 6:50 pm   Post subject: RE:Could anyone help please?

Quote:
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




PostPosted: Tue Dec 14, 2010 10:34 am   Post subject: 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.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: