Question:
Print the following pattern for the given N number of rows.
Pattern for N = 4
package HelloWorld;
import java.util.Scanner;
public class LearningJava {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// Print the following pattern for the given N number of rows.
// Pattern for N = 4
// 1
// 22
// 333
// 4444
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 i hamara row hai
Comments
Post a Comment