Page 1 of 1

QuickBasic - Code help.

Posted: Tue Mar 01, 2016 9:47 pm
by saveta
Hello people, i'm new here and i'd love some help with this :)
Image

i've tried to do so but i ended up with this:
Image

and here is my code:

Code: Select all

CLS
INPUT "Enter pyramid lines:", x
NEW:
FOR spaces = 1 to x
PRINT " ";
NEXT spaces
PRINT "*"
x = x - 1
IF X <> 0 THEN GOTO NEW
END
Thank you! :)

Re: QuickBasic - Code help.

Posted: Wed Mar 02, 2016 2:30 pm
by crossroads
Try this:

Code: Select all

CLS
INPUT "Enter pyramid lines: ", x
PRINT SPACE$(x - 1);
PRINT "*"
FOR i = 2 TO x
PRINT SPACE$(x - i);
PRINT "*";
PRINT SPACE$((i - 1) * 2 - 1);
PRINT "*"
NEXT i
END

Re: QuickBasic - Code help.

Posted: Sat Mar 05, 2016 3:29 am
by Cobramil

Code: Select all

CLS
INPUT "Enter pyramid lines: ", X
FOR I = X TO 1 STEP -1
  PRINT SPC(I - 1); "*";
  LOCATE , X * 2 - I
  PRINT "*"
NEXT