Draw Number Pattern in java

1
12
123
1234
12345

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


1
22
333
4444
55555

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

55555 4444 333 22 1
public class Pattern
{
   public static void main(String args[]){
    
       for(int i=5;i>=1;i--){
           for(int j=1;j<=i;j++){
               System.out.print(i);
            }
            System.out.println();
        }
    }
}

12345 1234 123 12 1

public class Pattern
{
   public static void main(String args[]){
    
       for(int i=5;i>=1;i--){
           for(int j=1;j<=i;j++){
               System.out.print(j);
            }
            System.out.println();
        }
    }
}

Comments

Popular posts from this blog

Make a GST Calculator using HTML and JavaScript

How to make simple bill maker by using python tkinter

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java