The
following pattern is displayed using both BlueJ and C programming language.
First program is in BlueJ.
1234
2341
3412
4123
class
Pat1
{
int i,j,x;
public void show()
{
for(i=0;i<4 i="i" span="span">4>
{
x=i+1;
for(j=0;j<4 j="j" span="span">4>
{
System.out.print(x);
x++;
if(x>4)
x=1;
}
System.out.println();
}
}
public
static void main(String args[])
{
Pat1 ob=new Pat1();
ob.show();
}
}
No comments:
Post a Comment