FreeBASIC
stars.bas
Usage:
Would output:
Or you could just run it straight and it prompts you for a number
Edited by axipher - 11/22/11 at 11:36am
stars.bas
Code:
dim as integer i, j, c, quit
dim as string s
s = command(1)
if val(s) > 0 then
c = val(s)
else
while quit = 0
input "Enter a number:",s
if val(s) > 0 then
c = val(s)
quit = 1
end if
sleep 1
wend
end if
? "Value chosen was: " & c
?
for i = 1 to c
for j = 1 to i
? "* ";
next
?
next
for i = (c - 1) to 1 step -1
for j = 1 to i
? "* ";
next
?
next
Usage:
Code:
stars.exe 5
Would output:
Code:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
Or you could just run it straight and it prompts you for a number
Edited by axipher - 11/22/11 at 11:36am














