Ask Experts Questions for FREE Help !
Ask
    natalie1xxx's Avatar
    natalie1xxx Posts: 120, Reputation: 3
    Junior Member
     
    #1

    Sep 20, 2009, 07:30 AM
    stuck on computing homework !
    Stuck on computing homework ? Help please!!
    okay well the question is " write two nested loops to print a pattern if stars on 12 lines of the screen. there should be one star on the first line, two stars on the second line, ... and so on until there are 12 stars on the 12th line. "

    there is also a little diagram of what it should look like .

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

    we use truebasics :) and I have tried to complete this task but its hard and I can't do it , here's what I've got so far.

    FOR down = 1 to 12
    LET across =0

    DO
    LET across = across +1

    PRINT "*";

    LOOP until across = down

    DO WHILE across <12
    PRINT "*";
    LET across = across +12
    LOOP
    PRINT
    NEXT down
    END


    which is probably ALL wrong but help please! Someone must be an expert at programming :) thanks xxxx
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Sep 21, 2009, 09:09 AM

    I think all you need is this loop:

    Let LengthOfString = 0
    For I = 1 To 12
    Let LengthOfString = LengthOfString + 1
    For j = 1 To LengthOfString
    Print "*"; ' This will print a star for as many as LengthOfString permits it to.
    Next j
    Print ' this will create a new line.
    Next I

    At the start of the inner loop, you increment a counter that determines how many stars to print.
    The inner loop ("j" is the index) prints a single character. You seen to know what the ';' is for.
    After the inner loop is finished. You need a newline to start printing on.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Homework language homework [ 1 Answers ]

You see well I have this homeworkassighmentthat isdo first thing in the morning so all I ask is that you write down some words in azorean langugauge! Words: Pencil Sharpener Paper Crayon Pen Binder

I'm stuck on homework! [ 1 Answers ]

Calculate the unknowns for the following situations based on the given data Actual total sales revenue $400,000 Total fixed cost $76,000 Unit variable cost $15 Contribution margin ration 40% a) Breakeven point in dollars b) unit selling price c) breakeven point in units

Computing ending inv. [ 3 Answers ]

I am trying to compute ending inventory and cost of goods sold using FIFO AND LIFO, however, I am not able to understand what to do or how to do it. Please help Units unit cost total cost June 1 inv. 200 5 1000 12...

Computing [ 1 Answers ]

(1) A rectangular block of wood is measured to have the dimensions 11.2 cm x 3.4 cm x 4.10 cm. Compute the volume of the block, showing explicitly (by underlining) how doubtful figures are carried through the calculation, and report the final answer with the correct number of significant figures....


View more questions Search