Advertisement
LegendSujay2019

program to make pyramid

Aug 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package pyramid;
  2. import java.util.Scanner;
  3. public class pyramid {
  4.     public static void main(String[] args) {
  5.          Scanner input= new Scanner(System.in);
  6.          System.out.println("Enter the no rows");
  7.          int n = input.nextInt();
  8.          for(int i = 1; i<=n; i++)
  9.          {
  10.              for (int c = 1; c<i; c++  )
  11.              {
  12.                   System.out.print("  ");
  13.             n--;
  14.             for (c = 1; c <= 2 * n-1; c++)
  15.                  System.out.print("*");
  16.             System.out.println(" ");
  17.                  
  18.              }
  19.     }
  20.    
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement