Skip to main content

Print the following pattern for the given N number of rows Java

Question: 

Pattern for N = 4
1
22
333
4444

 Ans: import java.util.Scanner;

public class Solution {


    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();

        for(int i=1; i<=n;i++){
            for (int j=1;j<=i;j++){
            System.out.print(i);
}
System.out.println();
        }
        
    
        
    }

}


yaha hamne i ko print kiya hai kyo ki question me row ke according hi hame column print krna hai 

Comments