pattern in java,
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
please..... help me
i can't understand this......
Attachments:
Answers
Answered by
1
Question:-
Write a program to display the pattern.
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Program:-
class Pattern
{
public static void main(String args[])
{
int a=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=4;j++)
{
System.out.print(a+" ");
a=a+1;
}
System.out.println();
}// end of outer loop.
}
}
Similar questions