Computer Science Canada I don't know how to use this easy loop . Please Help |
Author: | smallpudding [ Wed Feb 19, 2014 9:23 pm ] | ||
Post subject: | I don't know how to use this easy loop . Please Help | ||
What is it you are trying to achieve? <I have a homework tonight which is dealt with loop and for> What is the problem you are having? <We are supposed to write a program and its output shall look like this: rrrrr rrrr rrr rr r so basically, a letter repeats, and everytime there is a space at the beginning> Describe what you have tried to solve this problem <for x:1..5 put "r" end for> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <for, end for>
Please specify what version of Turing you are using <Turing 4.1.1> |
Author: | smallpudding [ Wed Feb 19, 2014 9:24 pm ] |
Post subject: | RE:I don\'t know how to use this easy loop . Please Help |
RRRRR spacex1RRRR spacex2RRR spacex3RR spacex4R |
Author: | Insectoid [ Wed Feb 19, 2014 10:35 pm ] |
Post subject: | RE:I don\'t know how to use this easy loop . Please Help |
You want to output 5 lines. You need a loop for that. Each of those lines is 5 characters long. You need a loop inside the first loop to do that. Now you need a way to decide whether to output a space or an R. You can probably use some math for this. Might have something to do with the for loop counter variables. |