Java Program to print pattern

♠ Posted by ANDROID THIRST in at 01:08













Program to create this pattern in java is :-

public class Pattern1 {
    public static void main(String[] args) {
        int r=14;
        for(int i=1;i<=5;i++){
            for(int j=1;j<=r;j++){
                System.out.print("-");
            }
            for(int k=1;k<=i;k++){
                System.out.print("#");
            }
            r=r-2;
            System.out.println();
        }
    }
   
}
   
"HAPPY PROGRAMMING"

0 comments:

Post a Comment