PATTERN 3 - CL2

Description:

"Write a java program to display the following patterns " Test Case 1 Input (stdin) 5 Expected Output * ** *** **** ***** Test Case 2 Input (stdin) 4 Expected Output * ** *** ****

Program :

import java.util.*;

public class TestClass {

public static void main(String[] args) {

       Scanner s=new Scanner(System.in);

       int rows=s.nextInt();

for(int i=1;i<=rows;i++) {

            for(int j=1;j<=i;j++) {

              if(j!=i)

                System.out.print("*");

              else

                System.out.print("*");

            }

            System.out.println();

        }

}

}