Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Descr: programa que demana un número enter i mostra el seu quadrat.
- */
- import java.io.*;
- public class piramide {
- public static void main(String[] args) throws IOException {
- System.out.print("Di un Número: ");
- int num = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());
- for(int i=0;i<num;i++){
- for(int j=1;j<num*2;j++){
- if(j<=num+i && j>=num-i){
- System.out.print("*");
- }else{
- System.out.print(" ");
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement