Results 1 to 2 of 2
  1. #1
    Mo-Money is offline Member
    Join Date
    Feb 2017
    Posts
    1
    Rep Power
    0

    Angry Break this down for me please!

    Im having trouble understanding how this code works. Could someone please just break down how it works for me so i know how to replicate it. Thank you!









    import java.util.Scanner;

    public class myawar_93165
    {
    public static void main(String[] args)
    {
    Scanner sc = new Scanner(System.in);



    System.out.println("How Many Rows You Want In Your Pyramid?");

    int Rows = sc.nextInt();



    int rowCount = 1;

    System.out.println("Here Is Your Pyramid.");



    for (int i = Rows; i > 0; i--)
    {


    for (int j = 1; j <= i; j++)
    {
    System.out.print(" ");
    }



    for (int j = 1; j <= rowCount; j++)
    {
    System.out.print("* ");
    }

    System.out.println();



    rowCount++;
    }
    }
    }

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Break this down for me please!

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    how it works for me
    Go through the code statement by statement and add a comment to each one describing what each statement does.
    If there are any statements you have questions on, flag them with a comment like: <<< WHAT DOES THIS DO

    Or if you know what most of the statements do, just flag the few statements you don't understand.

    Or ask the author of the code what it is supposed to do and how it does it.
    Last edited by Norm; 02-24-2017 at 09:08 PM.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Page break
    By mahamudsust in forum Apache POI
    Replies: 1
    Last Post: 03-01-2013, 12:50 PM
  2. How do you properly use break?
    By louist in forum New To Java
    Replies: 3
    Last Post: 03-08-2011, 02:58 AM
  3. break statement
    By AbdulAziz Bader in forum New To Java
    Replies: 17
    Last Post: 06-02-2010, 03:42 PM
  4. Break Clock
    By BruenorBH in forum Advanced Java
    Replies: 20
    Last Post: 09-12-2008, 05:27 AM
  5. How to use Break
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •