Pattern - 2
Logic--
for(int i=1; i<=5; i++)
{
for(int j=1; j<=5; j++)
{
System.out.print(j);
}
System.out.println( );
}
Program-
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
class Pattern2
{
public static void main(String[] args)
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=5; j++)
{
System.out.print(j);
}
System.out.println( );
}
}
}
No comments:
Post a Comment