Sunday, November 11, 2018

BlueJ Program To Print Pattern On 9 79 579 3579 And So On



Print the pattern

9
7 9
5 7 9
3 5 7 9
1 3 5 7 9

class PatternPrint
{
 public void show()
{
 int x=9,y;
for(int i=0; i< 5;i++)
{
y=x;
 for(int j=0;j<=i;j++)
{
 System.out.print(y+" ");
y=y+2;
}
System.out.println();
x=x-2;
}
}
public static void main(String args[])
{
 PatternPrint ob=new PatternPrint();
ob.show();
}
}

Related PostBlueJ Programs On Pattern

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner