How to print following number pattern in java?

♠ Posted by ANDROID THIRST at 02:01


Here is the code snippet to print this number pattern in java..........
public class Pattern1 {
    public static void main(String[] args) {
      
        for(int i=1;i<=5;i++){
            for(int k=5;k>=i;k--){
                System.out.print(k);
            }
            System.out.println();
           
    }
   
    }
}
HAPPY PROGRAMMING

0 comments:

Post a Comment