☀️ SUMMER SALE
🚀 Master Java → Build Real Projects → Crack Interviews → Get Hired
🚀 Crack Product/Service Based Company Interviews
from our Java Placement Courses
🔥 30% OFF Coupon: SUMMER30 Coupon: SUMMER30 View Courses
✓ Coupon Copied: SUMMER30

Number Pattern Programs in Java  


Program:
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
  • Program:
    public class NumberPattern5
    {
        public static void main(String[] args)
        {
            for(int i=1; i<=4; i++)
            {
                for(int j=1; j<=i; j++)
                {
                    System.out.print(j+" ");
                }
                for(int j=i-1; j>=1; j--)
                {
                    System.out.print(j+" ");
                }
                System.out.println();
            }
        }
    }