Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Piramide {
- public static void main(String[] args) {
- int num;
- Scanner entrada = new Scanner(System.in);
- System.out.print("Introduce un numero: ");
- num= entrada.nextInt();
- for (int i = 0; i < num; ++i) {
- System.out.println();
- for (int j = 0; j < num-i-1; ++j) {
- }
- for (int j = 0; j < 2*i+1; ++j){
- System.out.print("*");
- }
- }
- System.out.println();
- }
- }
- Introduce un numero: 7
- *
- ***
- *****
- *******
- *********
- ***********
- *************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement