Question:
Print the following pattern for the given N number of rows.
Pattern for N = 4
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
Post a Comment