Numbers Ladder (Sample Programs)

by lrcvs, Tuesday, July 16, 2013, 20:21 (1468 days ago)

From Yahoo answers:

http://ar.answers.yahoo.com/question/index?qid=20130711080152AAr8YV7

Translation:

Perform a program that receive as input a positive integer, to generate a figure like the one shown below:

1

1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Basic-256

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
x = 1 # <<<<<<<<<<<<< number
y$ = ""
for r = x to 10
for s = x to x+r
y$ = y$+string(s)
next s
for t = s-2 to x step - 1
y$ = y$ + string(t)
next t
print y$
y$ = ""
next r
end


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
12345678910987654321
123456789101110987654321

RSS Feed of thread
powered by my little forum