QuickBasic - Code help.

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
saveta
Newbie
Posts:1
Joined:Tue Mar 01, 2016 9:39 pm
QuickBasic - Code help.

Post by saveta » Tue Mar 01, 2016 9:47 pm

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! :)

User avatar
crossroads
Administrator
Posts:34
Joined:Wed Feb 13, 2002 10:15 pm
Location:Germany
Contact:

Re: QuickBasic - Code help.

Post by crossroads » Wed Mar 02, 2016 2:30 pm

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
crossroads (QBCafe Forum Admin)

Cobramil
Jr. Member
Posts:11
Joined:Sat Mar 05, 2016 3:22 am

Re: QuickBasic - Code help.

Post by Cobramil » Sat Mar 05, 2016 3:29 am

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

Post Reply