Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *Chapter 3 Project Number 1
- *
- * ZAIN ARFI
- * VERSION 1
- */
- import java.util.*;
- public class Chp3_Project1
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- System.out.println("How many segments would you like?");
- int segment = console.nextInt();
- System.out.println("How many rows would you like?");
- int height = console.nextInt();
- tree(segment, height);
- }
- public static int tree(int segment, int height)
- {
- return(
- for(int seg = 1; seg <= segment; seg++)
- {
- for(int row = 1; row <= height; row++)
- {
- for(int spaces = 1; spaces <= (row*-1+5); spaces++)
- {
- System.out.print(" ");
- }
- for(int stars = 1; stars <= (row*2-1); stars++)
- {
- System.out.print("*");
- }
- for(int spaces = 1; spaces <= (row*-1+5); spaces++)
- {
- System.out.print(" ");
- }
- System.out.println();
- }
- }
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement