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 Post: BlueJ Programs On Pattern
No comments:
Post a Comment