Inverted rotated piramid
import java.util.*;
// import java.util.Scanner;
public class practice {
public static void invertedrotated(int n){
for(int row=1;row<n;row++){
for(int col=1;col<=n-row;col++){
System.out.print(" ");
}
for(int col2=1;col2<=row;col2++){
System.out.print("*");
}
System.out.print("\n");
}
}
public static void main(String[] args) {
Scanner s =new Scanner(System.in);
int n;
System.out.println("Enter the size of square matrix");
n=s.nextInt();
invertedrotated(n);
}
}
Output -
Comments
Post a Comment