Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package tamgiaccan;
  2. import java.util.Scanner;
  3. public class TamGiacCan
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner mk = new Scanner(System.in);
  8.        int n= mk.nextInt();
  9.        
  10.        if(n<1|| n>100)
  11.        {
  12.            System.out.print("\n Erorr !!");
  13.        }
  14.          for(int i=0;i<n;i++)
  15.         {
  16.             for(int k=0;k<n-i;k++)
  17.             {
  18.                 System.out.print(" ");
  19.             }
  20.             for(int t=0;t<2*i+1;t++)
  21.                 {
  22.                     System.out.print("*");  
  23.                 }
  24.             System.out.print("\n");
  25.         }
  26.     }
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement