Aim:- Write a program to print following pattern
1
2 2
3 3 3
N N .........................N
Software used:- Notepad, Command prompt
Program coding:-
public class pattern {
public static void main(String[] args) {
int n=9;
for(int i=1;i<=n;i++) {
for(int j=1;j<=i;j++) {
System.out.print(i + " ");
}
System.out.print("\n");
}
}
}
0 Comments
if you have any problem, please let me know