Search:

Type: Posts; User: Norm

Search: Search took 0.16 seconds.

  1. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    Yes, something like that. The variable name k is a bit obscure: k??? instead of nbrOfRows that describes what is in it.
  2. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    Replace the numbers 4 and 5 with variables. Don't hard code numbers in the code.
    Then write a method that takes the number of rows as its arg.
    Call the method with different values for the number...
  3. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    All the 5s and 4s should be replaced by variables. The 2 is ok because it is used to get half of a value and would never change.
  4. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    You could Wrap the post of the output in code tags to preserve the leading spaces so we can see its shape.

    Glad you solved it.

    Note: The code has too many "magic numbers". Can you change it so...
  5. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    Can you describe the pattern of the desired output:
    how many lines are printed?
    what goes on each line?
    How does what is printed on a line relate to what line is being printed?
  6. Replies
    12
    Views
    1,424

    Re: Display patterns using loops

    Can you post the program's current output to show what it does?

    Describe the pattern of the output:
    how many lines are printed?
    what goes on each line?
Results 1 to 6 of 6