Wednesday, May 24, 2017

Pattern On Numbers And Space


1
1_2
1_2_3
1_2_3_4
1_2_3_4_5
_ stands for space 


class A
{
 int i,j;
public void show()
{
 for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
 System.out.print(j+" ");
}
System.out.println();
}
}
public static void main(String args[])
{
 A ob=new A();
ob.show();
}
}

Related PostBlueJ Programs On Pattern

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner