34 Comments

  1. Imran B

    please give a program in java that’s output is:

    1
    2 1
    3 2 1
    4 3 2 1
    5 4 3 2 1

    Reply
  2. maha

    can u please help me to print the letters M and G in stars ?Please this is urgent.

    Reply
  3. Tejashri

    will you please help me out with this pattern?

    1 2 3 4 5 4 3 2 1
    2 3 4 5 4 3 2
    3 4 5 4 3
    4 5 4
    5

    Reply
    • srimanta de

      plz give solved problem

      Reply
  4. Ravi

    How to print
    1
    ab
    234
    cdef
    56789

    Reply
  5. pritam

    Help me out
    5 4 3 2 1 * 1 2 3 4 5
    4 3 2 1 * * * 1 2 3 4
    3 2 1 * * * * * 1 2 3
    2 1 * * * * * * * 1 2
    1 * * * * * * * * * 1

    Reply
    • sudheersai

      class r
      {
      public static void main(String args[])
      {
      int s=1;
      for(int i=5;i>=1;i–)
      {
      for(int j=i;j>=1;j–)
      {
      System.out.print(j+” “);
      }
      for(int k=1;k<=s;k++)
      {
      System.out.print("* ");
      }
      for(int h=1;h<=i;h++)
      {
      System.out.print(h+" ");
      }
      System.out.println("");
      s+=2;
      }
      }
      }

      Reply
  6. Kajal

    Can u hepl with the following pattern
    A
    BA
    CBA
    DCBA

    Reply
  7. Shreyashi Mukherjee

    I
    IC
    ICS
    ICSE

    Reply
  8. google user

    how to print
    Y
    PY
    PPY
    APPY
    HAPPY

    Reply
  9. yankho

    how can I make star patterns of letters ..E.g “ABBA”

    Reply
  10. Sai Sarvani

    I need the output :10 20 30 40
    20 30 40 10
    30 40 10 20
    40 10 20 30

    Reply
    • Anirudh

      I want this program

      Reply

    • import java.util.*;
      public class PrintNumbers {
      static Scanner in=new Scanner(System.in);
      public static void main(String args[])
      {
      int num=0;
      System.out.println(“Enter the Count Of Numbers”);
      num=in.nextInt();
      System.out.println(“Enter the numbers one by one”);
      int numbers[]=new int[num];
      try
      {
      for(int i=0;i<num;i++)
      {
      numbers[i]=in.nextInt();
      }
      PrintFormat(numbers);
      }
      catch(Exception e)
      {
      System.out.println(e.getMessage());
      }

      }

      public static void PrintFormat(int number[])
      {
      try
      {
      int length=number.length;
      for(int i=0;i<length-1;i++)
      {
      int temp=number[0];
      for(int j=0;j<length-1;j++)
      {
      number[j]=number[j+1];
      System.out.print(number[j]+" ");
      }
      number[length-1]=temp;
      System.out.print(" "+temp);
      System.out.println();

      }
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }

      }

      }

      Reply

    • import java.util.*;
      public class PrintNumbers {
      static Scanner in=new Scanner(System.in);
      public static void main(String args[])
      {
      int num=0;
      System.out.println(“Enter the Count Of Numbers”);
      num=in.nextInt();
      System.out.println(“Enter the numbers one by one”);
      int numbers[]=new int[num];
      try
      {
      for(int i=0;i<num;i++)
      {
      numbers[i]=in.nextInt();
      }
      PrintFormat(numbers);
      }
      catch(Exception e)
      {
      System.out.println(e.getMessage());
      }

      }

      public static void PrintFormat(int number[])
      {
      try
      {
      int length=number.length;
      for(int i=0;i<length-1;i++)
      {
      int temp=number[0];
      for(int j=0;j<length-1;j++)
      {
      number[j]=number[j+1];
      System.out.print(number[j]+" ");
      }
      number[length-1]=temp;
      System.out.print(" "+temp);
      System.out.println();

      }
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }

      }

      }

      Reply
  11. oumar

    hello could u helps me out ….
    this pattrn

    11
    2112
    321123
    43211234

    Reply
  12. dhanu

    how to print
    ******
    ** **
    * *
    ** **
    ******

    Reply
  13. kanimozhi m

    1 2 3 2 1 0
    4 3
    5 6 7 6 5 4

    8*9*9*8*7 please solve this problem

    Reply
  14. vicky

    How to print this pattern
    1
    24
    135
    2468
    13579
    Guys

    Reply
    • balaji

      public class MyClass {
      public static void main(String args[]) {
      int i=1;
      int m=2;
      for (int j=1; j<=5; j++){
      int l=m;
      int p=i;
      for (int k=1; k<=j; k++){

      if ((j%2)==0){
      System.out.print(l);
      l=l+2;
      }
      if ((j%2)==1){
      System.out.print (p);
      p=p+2;
      }
      }
      System.out.println();
      }

      }
      }

      Reply
  15. Biswajit Sahu

    L
    LO
    LOT
    LOTU
    LOTUS
    PLS slove this problem

    Reply
    • balaji

      public class MyClass {
      public static void main(String args[]) {
      String s=”LOTUS”;
      char [] a=s.toCharArray();
      String n=””;
      for (int i=0; i<5; i++){
      n=n+a[i];
      System.out.println(n);

      }

      }
      }

      Reply
    • Ranjith M

      import java.util.Scanner;
      public class First {
      public static void main(String args[])
      {
      System.out.println(“Enter the String”);
      Scanner sc=new Scanner(System.in);
      String n=sc.nextLine();
      for(int i=0;i<n.length();i++)
      {
      for(int j=0;j<=i;j++)
      {
      System.out.print(n.charAt(j));
      }
      System.out.println("");
      }
      }
      }

      Reply
  16. Shiv

    ABCDEFGFEDCBA
    ABCDEF FEDCBA
    ABCDE EDCBA
    ABCD DCBA
    ABC CBA
    AB BA
    A A

    Reply
  17. siva

    ABCDE
    ABCD
    ABCD
    ABC
    AB
    A

    Reply
    • Max

      AAAAA
      ABBBB
      ABCCC
      ABCDD
      ABCDE

      Reply

Leave a Reply.. code can be added in <code> </code> tags