Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   Qbasic programing (https://www.askmehelpdesk.com/showthread.php?t=408733)

  • Oct 22, 2009, 03:10 PM
    Simonne
    Qbasic programing
    Please help me I have no idea how to program this thing!


    Develop a program using loops that displays rows of asterisks in two different ways:
    1. Ascending then Descending

    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
    ********
    *******
    ******
    *****
    ****
    ***
    **
    *
    2. Descending then Ascending

    *********
    ********
    *******
    ******
    *****
    ****
    ***
    **
    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********

    The maximum number of asterisks in any row is 9.
    The program should prompt the user as to which of the above
    Display methods should be used.

    Hint: Use nested loops.
  • Oct 22, 2009, 03:32 PM
    ScottGem

    QBasic.com
  • Oct 23, 2009, 02:23 PM
    Perito
    Ascending then Descending:

    For I = 1 to 9
    for j = 1 to I
    Print "*"; ' the semi-colon prevents a new line from being written
    next j
    print ' gets a new line
    next I
    for I = 8 to 1 step -1 ' I'm not sure this is QuickBasic's syntax, but there is something.
    for j = 1 to I
    print "*"; ' the semicolon prevents a new line from being written.
    next j
    print ' gets a new line.
    next I

    Descending then ascending is very similar.

    There are many other ways to program this also -- some simpler than others.
  • Oct 26, 2009, 07:50 AM
    Simonne

    Thank you very much for your help, I will try it out and see what I get.
    Thanks
  • Nov 10, 2009, 09:10 AM
    Simonne

    Thank you that really did help.

  • All times are GMT -7. The time now is 09:04 AM.