Created
May 19, 2024 18:14
-
-
Save duranangie/d7f750a2e11933a737039fd5f207dad8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package arbolNavidad; | |
import java.util.Scanner; | |
public class ArbolNavidad { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
int altura=9; | |
for(int fila=0;fila<altura;fila++){ | |
//bucle espacio | |
for(int espacio=0;espacio<(altura-fila-1);espacio++){ | |
System.out.print(" "); | |
} | |
//bucle altura} | |
for(int asterisco=0;asterisco<(fila*2)+1;asterisco++){ | |
System.out.print("*"); | |
} | |
System.out.println(" "); | |
} | |
int tronco = 3; | |
for(int base =0 ; base<tronco;base++){ | |
for(int espacio=0;espacio<(altura-2);espacio++){ | |
System.out.print(" "); | |
} | |
for(int largo = 0;largo<3;largo ++){ | |
System.out.print("|"); | |
} | |
System.out.println(""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment