Search:

Type: Posts; User: John Joe

Search: Search took 0.08 seconds.

  1. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    Thanks, I will aware of the variables used next time :rolleyes:
  2. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    I think you mean this ?


    public class Example {

    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.print("Key in the row you want it to display:...
  3. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    Don't understand :)] Did you mean it would be better if I assign a variable to 4 and 5 ?
  4. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    This is the output

    *
    * *
    * * *
    * *
    *
    What did you mean "magic numbers" ?
  5. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    Thanks for your reply Norm, I actually want it to print a diamond.
    I have solved it.


    for (int i = 1; i < 5; i += 2) {
    for (int j = 0; j < 4 - i / 2; j++)
    System.out.print(" ");...
  6. Replies
    12
    Views
    1,422

    Re: Display patterns using loops

    Current output is

    *
    ***
    *****
    *******
    *********
  7. Replies
    12
    Views
    1,422

    Display patterns using loops

    Used nested loops that display following patterns


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

    I only able to have this, after that...
Results 1 to 7 of 7