
-----------------------------------
pmeth0
Wed Mar 07, 2007 12:09 pm

how would i do this?
-----------------------------------
Im a turing noob and my friend who is older has this project he wanted me to help him figure out how to do but im so lost its not even funny.

How would i do this it goes as following.

"Write a program to output a table of values of the integers st 1 and their squares. Label the table at the top of the column example, your output might look somthing like this

Number  Square
1              1
2              4
3              9
4              16
5              25

Try to format the output so that it looks attractive. What happends to the numbers get larger and larger? change the program to output first 100 integers rather than attempting to go on forever.

6b. Modify your program so that in one for loop you output the following

Num  Square  Num Square Num Square  Num Square 
1          1         21    441      41    1681     61    372
2          4         22    484      42    1764     62    386

continue through to

20 400 40 1600 60 3600 80 6400

7. Write a program using a loop counting backwards. Output the input of the loop on each excution so the output is the same as the c down for a rocket launch. Arrange the output so that it is all on line like this

5 4 3 2 1 
""


Thanks!

-----------------------------------
Cervantes
Wed Mar 07, 2007 2:04 pm

RE:how would i do this?
-----------------------------------
Here, let's do the first one together.

We'll use a for loop to iterate through the integers from 1 to 20, say. 

for i : 1 .. 20
   % code here
end for

For each integer, we want to output the integer and then a space and then the square of that integer. Okay, that's really easy:

for i : 1 .. 20
    put i, " ", i ** 2
end for


So that's that. If you want to pretty it up to make things align nicer, you can.

For the second one, you might want to use locate to locate your output. But that's actually probably making it harder. Find the pattern for each line, and do it line by line.
