JAVA Pattern Programs || WORPS Khariar Exam - 👑 सार्थक मुंड S3 🤴🏻

JAVA Pattern Programs || WORPS Khariar Exam

PATTERN 1 :-

import java.util.Scanner;
class WORPS
{
    public static void main()
    {
        System.out.println("Enter Any Word :");
        Scanner sc=new Scanner(System.in);
        String s;
        s=sc.next();
        char ch1;
        int d=s.length();
        for(int i=d-1;i>=0;i--)
        {
            for(int j=0;j<=i;j++)
            {
            ch1=s.charAt(j);
            System.out.print(ch1+" ");
        }
        System.out.println();
    }
}
}
JAVA Pattern Programs

PATTERN 2 :-

import java.util.Scanner; 
public class WORPS1
{            
   public static void main() 
   {
        for (int i = 5; i >= 1; i--)
        {
          int n = 5;
            for (int j = 0; j<= n - i; j++)
            { 
                System.out.print(" ");
            }
            for (int k = i; k >= 1; k--)
            {
                System.out.print(k);
            }
          System.out.println();
        }
   }
}
JAVA Pattern Programs || WORPS Khariar

Must Read :-

  1. Blogger Tutorial
  2. C Programs
  3. C++ Programs
  4. Java Programs
  5. Python Programs
  6. Programming Notes 
  7. Questions & Answers
  8. My Codes : HTML, CSS & JS
Previous article
Next article

Leave Comments

Post a Comment

Articles Ads

Articles Ads 1

Articles Ads 2

Advertisement Ads