SHARE
TWEET

Untitled

a guest Jun 17th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class Piramide {
  3.  
  4.     public static void main(String[] args) {
  5.  
  6.         int num;
  7.         Scanner entrada = new Scanner(System.in);
  8.  
  9.         System.out.print("Introduce un numero: ");
  10.         num= entrada.nextInt();
  11.  
  12.         for (int i = 0; i < num; ++i) {
  13.  
  14.             System.out.println();
  15.  
  16.             for (int j = 0; j < num-i-1; ++j) {
  17.  
  18.                 }
  19.  
  20.             for (int j = 0; j < 2*i+1; ++j){
  21.  
  22.                 System.out.print("*");
  23.                 }
  24.  
  25.         }
  26.  
  27.         System.out.println();
  28.  
  29.             }
  30.     }
  31.      
  32. Introduce un numero: 7
  33.  
  34. *
  35. ***
  36. *****
  37. *******
  38. *********
  39. ***********
  40. *************
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top