Results 1 to 4 of 4

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Dec:2008
    Location: Karlsruhe
    Posts: 13

    ...
    public class Tannenbaum {
    int maxSize;
    public Tannenbaum(int maxSize) {
    this.maxSize = maxSize+1;
    }
    public void print() {
    printTanne(0);
    }
    private void printTanne(int size) {
    if(size<=maxSize) {
    for(int i=1; i<size+1; i++) {
    for(int j=0; j<i; j++) {
    System.out.print("*");
    }
    System.out.println();
    }
    printTanne(size+1);
    }
    }

    public static void main(String[] args) {
    Tannenbaum t = new Tannenbaum(6);
    t.print();
    }
    }

  2. #2
    XaMaB's Avatar
    Join Date: Nov:2001
    Location:
    Posts: 20,387
    printDryjkata (), ,
    : XaMaB; . 0.42

    In God we Trust (all others must submit a X.509 certificate). , ()

  3. #3
    Registered User
    Join Date: Dec:2008
    Location: Karlsruhe
    Posts: 13


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

  4. #4
    XaMaB's Avatar
    Join Date: Nov:2001
    Location:
    Posts: 20,387
    ,
    for(int i=1; i<size+1; i++) {
    for(int j=0; j<i; j++) {
    , . 2 "*". printDryjkata ()
    : XaMaB; . 0.42

    In God we Trust (all others must submit a X.509 certificate). , ()

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |