Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- /*
- Write a program to generate following pattern using for loop and
- if statement.
- 1
- 22
- 333
- 4444
- 55555
- 6666
- 777
- 88
- 9
- */
- public class iffor{
- public static void main(String args[]){
- for (int x=1; x<=9; x++){
- if(x<=5){
- for(int y=1; y<=x; y++){
- System.out.print(x);
- }
- System.out.println("");
- }
- else{
- for(int z=9; z>=x; z--){
- System.out.print(x);
- }
- System.out.println("");
- }
- }
- }
- }

It really helped, thanks
1 *2
if got solution please send
Thanks for the code. It is
plz send
how do you
how do you
Many automotive repairs or
how to create this
how to create this pattern??
Post new comment