Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  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. *************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement