half pyramid pattern 180' rotate in java.

■》 code link -> click πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡



■》Input->

import java.util.*;
public class halfpyramid180 {
    public static void main(String[] args) {
        int n;
        Scanner sc=new Scanner(System.in);
        System.out.println("enter no. of rows=");
        n=sc.nextInt();
        for(int i=1; i<=n; i++){
            for(int j=1; j<=n-i; j++){
                System.out.print(" ");
            }
            for(int k=1; k<=i; k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
■》Output->
enter no. of rows=>4
                     

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.