Solid Rhombus Pattern

 import java.util.*;


// import java.util.Scanner;

public class practice {

    public static void rhombus(int n){

        for(int row=1;row<=n;row++){

            for(int space=1;space<=n-row;space++){

                System.out.print(" ");

            }

            for(int star=1;star<=n;star++){


                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 no of stars on rhombus");

        n=s.nextInt();
        rhombus(n);

           
    }

}

Output :-

Comments

Popular posts from this blog

Convert first letter to capital letter in java

Stair case traversal search

Time conversion into IST