Dain1234 / Java-Programming

0 stars 0 forks source link

Pyramid pattern #22

Open Dain1234 opened 1 year ago

Dain1234 commented 1 year ago

package com.dain.logics; import java.util.Scanner;

public class pyramidpattern { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the rows:"); int r = sc.nextInt(); for (int i = 1; i <= r; i++) { for (int j = 1; j <= r - i; j++) { System.out.print(" "); } for (int k = 1; k <= i; k++) { System.out.print(" *"); } System.out.println(); }

}

}