30 Comments

  1. Gihan Lavindu

    Please help me to print this code…

    1
    2 2
    0 0 0
    1 1 1 1
    2 2 2 2 2
    0 0 0 0 0 0

    Reply
  2. shubham jain

    how to make the pattern.
    1
    232
    34543
    and
    1
    23
    345
    4567

    Reply

  3. How to print this pattern.

    9204605198
    920460519
    92046051
    9204605
    920460
    92046
    9204
    920
    92
    9

    Reply
  4. manas sawant

    using for loop
    1111
    000
    11
    0

    print this pattern.

    Reply
  5. soujanya

    Alternate solution for Pattern 5

    public class Pattern{
    public static void main(String[] args) {
    int n =5;
    for(int i=1;i<=n;i++)
    {
    for(int j=1;j<=i;j++)
    {
    if((i%2==0&&j%2==0)|(i%2!=0&&j%2!=0)) //if both i and j are even or both are odd then
    print 1
    System.out.print(1+" ");
    else
    System.out.print(0+" ");

    }

    System.out.println();
    }

    }
    }

    Reply
  6. Siddharth

    please help me in

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

    Reply
    • anshol

      void main()
      {
      for(int i=1;i=1;j++)
      {
      System.out.print(j);
      }
      System.out.println();
      }
      }

      Reply
  7. Debashis Nanda

    Help me to print this pattern
    * * * * *
    * *
    * *
    * *
    * * * * *

    Reply
  8. Debashis Nanda

    Help me to print this pattern in java
    * * * * * * *
    * * * * *
    * * *
    *
    * * *
    * * * * *
    * * * * * * *

    Reply
  9. lakshay

    help
    * *
    ** **
    *** ***
    **** ****
    **********

    Reply
  10. ac

    can you help me with this program

    0
    1 0 1
    2 1 * 1 2
    1 0 1
    0

    Reply
  11. Nicole

    1
    121
    12321
    1234321
    123454321
    12345654321
    1234567654321
    12345654321
    123454321
    1234321
    12321
    121
    1
    please help me with this one 🙁

    Reply
    • Krishnan Mishra

      1
      121
      12321
      1234321
      123454321
      12345654321
      1234567654321
      12345654321
      123454321
      1234321
      12321
      121
      1

      class JavaApplication1{

      public static void main(String args[]) {
      for(int i=1;i<8;i++){
      int j=1;
      while(j1){
      System.out.print(–l);
      }
      System.out.println();
      }
      for(int i=6;i>0;i–){
      int j=1;
      while(j1)
      System.out.print(–l);
      System.out.println();
      }
      }
      }

      Reply
  12. stuti

    0
    101
    21012
    3210123
    432101234
    send me code for this

    Reply
    • Richard

      /*

      0
      101
      21012
      3210123
      432101234
      */
      import java.util.Scanner;
      public class Pattern
      {
      public static void main(String[] args)
      {
      Scanner scanner =new Scanner(System.in);
      System.out.println(“Enter No of rows : “);
      int n=scanner.nextInt();
      int k=0;
      boolean addCheck;
      for(int i=0;i<n;i++)
      {
      k=i;
      addCheck=false;
      for(int j=0;j0)
      {
      System.out.print(k);
      if(!addCheck)
      {
      k–;
      }
      else
      {
      k++;
      }
      }
      else if(k==0)
      {
      System.out.print(k);
      addCheck=true;
      k++;
      }
      }
      System.out.println();
      }
      }
      }

      Reply
  13. SAURABH KUMAR YADAV

    Help me print this pattern
    12345
    21234
    32123
    43212
    54321

    Reply
    • Krishnan Mishra

      /*
      1 2 3 4 5
      2 1 2 3 4
      3 2 1 2 3
      4 3 2 1 2
      */

      class JavaApplication1{

      public static void main(String args[]) {
      for(int i=1;i<5;i++){
      for(int j=1,k=i,l=1,m=5-i;j0){
      System.out.print(k–+” “);
      }
      while(m>0){
      System.out.print(++l +” “);
      m–;
      }
      }
      System.out.println();
      }
      }
      }

      Reply
  14. saptaparna basu

    help me
    0
    1 2
    3 4 5
    9 8 7 6
    5 4 3
    2 1
    0

    Reply

  15. help to this one/

    1
    212
    32123
    4321234
    543212345
    65432123456
    7654321234567
    65432123456
    543212345
    4321234
    32123
    212
    1

    Reply
  16. aravinth

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

    Reply
    • KIRUBHA

      int rowCount=5;
      for(int i=1;i<=rowCount;i++){
      for(int j=1;j<=i;j++){
      System.out.print(i);
      }
      System.out.println();
      }

      Reply
  17. Honey Villamor

    This one?
    1
    2 1 2
    3 2 1 2 3
    4 3 2 1 2 3 4
    5 4 3 2 1 2 3 4 5
    4 3 2 1 2 3 4
    3 2 1 2 3
    2 1 2
    1

    Thanks.

    Reply

    • ye program bna k nhi bhai

      Reply
    • Krishnan Mishra

      /*
      1
      2 1 2
      3 2 1 2 3
      4 3 2 1 2 3 4
      5 4 3 2 1 2 3 4 5
      4 3 2 1 2 3 4
      3 2 1 2 3
      2 1 2
      1
      */

      class JavaApplication1{

      public static void main(String args[]) {
      for(int i=1;i<6;i++){
      for(int j=1,k=i,l=1;j0){
      System.out.print(k–+” “);
      }
      while(l0;i–){
      for(int j=1,k=i,l=1;j0){
      System.out.print(k–+” “);
      }
      while(l<i){
      System.out.print(++l +" ");
      }
      }
      System.out.println();
      }
      }
      }

      Reply
  18. sangeetha

    help me for this pattern
    1
    3 2
    6 5 4
    10 9 8 7
    15 14 13 12 11

    Reply
    • Krishnan Mishra

      1
      3 2
      6 5 4
      10 9 8 7
      15 14 13 12 11

      class JavaApplication1{

      public static void main(String args[]) {
      for(int i=1;i0){
      System.out.print(s– + ” “);
      j–;
      }
      System.out.println();
      }
      }
      }

      Reply
  19. ganesh

    how to print this patterns
    1
    11
    121
    1331

    and
    #
    #*
    #*#
    #*#*
    #*#*#
    please help

    Reply

    • #
      #*
      #*#
      #*#*
      #*#*#
      // the code is here

      class Main
      {
      public static void main(String args[])
      {
      int n=5;
      for(int i=0;i<n;i++)
      {
      for(int j=0;j<=i;j++)
      {
      if(j%2==0)
      System.out.print("#");
      else
      System.out.print("*");
      }
      System.out.println();
      }
      }
      }

      Reply
  20. S .Pranav Balaji

    Help me print this pattern

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

    Reply
  21. Matej Rastocky

    And pytagoras triangle ? 😮

    Reply

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