how to print 1 2 3 4 5
2 2 3 4 5
3 3 3 4 5
4 4 4 4 5
5 5 5 5 5
In java
Answers
Answered by
1
Answer:
1 2 3 4 5
2 3 3 4 5
3 3 3 4 5
4 4 4 4 5
5 5 5 5 5
Explanation:
hope to help.
Answered by
1
Answer:
public class Pattern7 {
public static void main(String[] args) {
int i,j,n=5;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++) {
if(j>=i)
{
System.out.print(j);
}
else
{
System.out.print(i);
}
}
System.out.println();
}
}
}
Explanation:
Similar questions