10 Challenging number pattern programs in C

by Utsav Banerjee on November 8, 2009


This is a continuation to the series of challenging pattern C programs in Interview Mantra. This set of 10 puzzling programs are of type number patterns.

Also read Print Pattern Programs

  1. Write a C program to print the following pattern:
    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1
  2. Write a C program to print the following pattern:
    0
    1 1
    2 3 5
    8 13 21
  3. Write a C program to print the following pattern:
    1
    121
    12321
    1234321
    12321
    121
    1
  4. Write a C program to print the following pattern:
           2
         4 5 6
       6 7 8 9 10
         4 5 6
           2
  5. Write a C program to print the following pattern:
     1                         1
     3 3 3                 3 3 3
     5 5 5 5 5         5 5 5 5 5
     7 7 7 7 7 7 7 7 7 7 7 7 7 7
     5 5 5 5 5         5 5 5 5 5
     3 3 3                 3 3 3
     1                         1
  6. Write a C program to print the following pattern:
        0
     -2-3 0
    -4-3-2-1 0
     -2-3 0
        0
  7. Write a C program to print the following pattern:
    77777777777
             7
            7
           7
          7
         7
        7
       7
      7
     7
    7
  8. Write a C program to print the following pattern:
     1                       1
     1 0                   1 0
     1 0 1               1 0 1
     1 0 1 0           1 0 1 0
     1 0 1 0 1       1 0 1 0 1
     1 0 1 0 1 0   1 0 1 0 1 0
     1 0 1 0 1 0 1 0 1 0 1 0 1
     1 0 1 0 1 0   1 0 1 0 1 0
     1 0 1 0 1       1 0 1 0 1
     1 0 1 0           1 0 1 0
     1 0 1               1 0 1
     1 0                   1 0
     1                       1
  9. Write a C program to print the following pattern:
    1
    2 4
    3 6 9
    2 4
    1
  10. Write a C program to print the following pattern:
     1
     1 0
     1 0 0
     1 0 0 0
     1 0 0 0 0
     1 0 0 0 0 0
     1 0 0 0 0 0 0
     1 0 0 0 0 0
     1 0 0 0 0
     1 0 0 0
     1 0 0
     1 0
     1

  1. Write a C program to print the following pattern:
  2. 1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1

    Program:

    #include <stdio.h>
    
    int main(void) {
     int i, j;
     for (i = 0; i < 4; i++) {
      for (j = 0; j <= i; j++) {
       if (((i + j) % 2) == 0) {  // Decides on as to which digit to print.
        printf("0");
       } else {
        printf("1");
       }
       printf("\t");
      }
      printf("\n");
     }
     return 0;
    }

    Download Code

    Explanation: This is a right angle triangle composed of 0′s and 1′s.
    Back to top

    End of Question1 Start of Question2

  3. Write C program to print the following pattern:
    0
    1 1
    2 3 5
    8 13 21
  4. Program:

    #include <stdio.h>
    
    int main(void) {
     int i, j, a = 0, b = 1, temp = 1;
     for (i = 1; i <= 4; i++) {
      for (j = 1; j <= i; j++) {
       if (i == 1 && j == 1) { // Prints the '0' individually first
        printf("0");
        continue;
       }
       printf("%d ", temp);  // Prints the next digit in the series
       //Computes the series
       temp = a + b;
       a = b;
       b = temp;
       if (i == 4 && j == 3) { // Skips the 4th character of the base
        break;
       }
      }
      printf("\n");
     }
     return 0;
    }

    Download Code

    Explanation: This prints the Fibonacci series in a right angle triangle formation where the base has only three characters.
    Back to top

    End of Question2 Start of Question3

  5. Write C program to print the following pattern:
    1
    121
    12321
    1234321
    12321
    121
    1
  6. Program:

    #include <stdio.h>
    
    void sequence(int x);
    int main() {
     /* c taken for columns */
     int i, x = 0, num = 7;
     for (i = 1; i <= num; i++) {
      if (i <= (num / 2) + 1) {
       x = i;
      } else {
       x = 8 - i;
      }
      sequence(x);
      puts("\n");
     }
     return 0;
    }
    
    void sequence(int x) {
     int j;
    
     for (j = 1; j < x; j++) {
      printf("%d", j);
     }
     for (j = x; j > 0; j--) {
      printf("%d", j);
     }
    }

    Download Code
    Back to top

    End of Question3 Start of Question4

  7. Write a C program to print the following pattern:
           2
         4 5 6
       6 7 8 9 10
         4 5 6
           2
  8. Program:

    #include <stdio.h>
    
    int main(void) {
     int prnt;
     int i, j, k, r, s, sp, nos = 3, nosp = 2; //nos n nosp controls the spacing factor
     // Prints the upper triangle
     for (i = 1; i <= 5; i++) {
      if ((i % 2) != 0) {
       for (s = nos; s >= 1; s--) {
        printf("  ");
       }
       for (j = 1; j <= i; j++) {
        if (i == 5 && j == 5) { //Provides the extra space reqd betn 9 n 10
         printf(" ");        // as 10 is a 2 digit no.
        }
        prnt = i + j;
        printf("%2d", prnt);
       }
      }
      if ((i % 2) != 0) {
       printf("\n");
       nos--;
      }
     }
     // Prints the lower triangle skipin its base..
     for (k = 3; k >= 1; k--) {
      if ((k % 2) != 0) {
       for (sp = nosp; sp >= 1; sp--) {
        printf("  ");
       }
       for (r = 1; r <= k; r++) {
        prnt = k + r;
        printf("%2d", prnt);
       }
      }
      if ((k % 2) != 0) {
       printf("\n");
       nosp++;
      }
     }
     return 0;
    }

    Download Code

    Explanation: This is a diamond formation composed of numbers. The numbers are in the following order next_no=i+j where
    next_no = The next no to be printed
    i = index of the outer for loop
    j = index of the inner for loop
    Back to top

    End of Question4 Start of Question5

  9. Write a C program to print the following pattern:
     1                           1
     3 3 3                   3 3 3
     5 5 5 5 5           5 5 5 5 5
     7 7 7 7 7 7 7   7 7 7 7 7 7 7
     5 5 5 5 5           5 5 5 5 5
     3 3 3                   3 3 3
     1                           1
  10. Program:

    #include <stdio.h>
    
    int main(void) {
     int i, j, k, s, p, q, sp, r, c = 1, nos = 13;
     for (i = 1; c <= 4; i++) {
      if ((i % 2) != 0) {   // Filters out the even line nos.
       for (j = 1; j <= i; j++) { // The upper left triangle
        printf("%2d", i);
       }
       for (s = nos; s >= 1; s--) {  // The spacing factor
        printf("  ");
       }
       for (k = 1; k <= i; k++) { // The upper right triangle
        printf("%2d", i);
       }
       printf("\n");
       nos = nos - 4;  // Space control
       ++c;
      }
     }
     nos = 10;  // Space control re intialized
     c = 1;
     for (p = 5; (c < 4 && p != 0); p--) {
      if ((p % 2) != 0) {  // Filters out the even row nos
       for (q = 1; q <= p; q++) {  // Lower left triangle
        printf("%2d", p);
       }
       for (sp = nos; sp >= 1; sp--) { // Spacing factor
        printf(" ");
       }
       for (r = 1; r <= p; r++) {  // Lower right triangle
        printf("%2d", p);
       }
    
       printf("\n");
       --c;
       nos = nos + 8;  // Spacing control.
      }
     }
    
     return 0;
    }

    Download Code

    Explanation: Here we are printing only the odd row nos along with thier respective line number. This structure can divided into four identical right angle triangles which are kind of twisted and turned placed in a particular format .
    Back to top

    End of Question5 Start of Question6

  11. Write a C program to print the following pattern:
        0
     -2-3 0
    -4-3-2-1 0
     -2-3 0
        0
  12. Program:

    #include <stdio.h>
    
    int main(void) {
     int i, j, k, r, s, sp, nos = 2, nosp = 1;
     for (i = 1; i <= 5; i++) {
      if ((i % 2) != 0) {
       for (s = nos; s >= 1; s--) {  //for the spacing factor.
        printf("  ");
       }
       for (j = 1; j <= i; j++) {
        printf("%2d", j-i);
       }
      }
      if ((i % 2) != 0) {
       printf("\n");
       nos--;
      }
     }
     for (k = 3; k >= 1; k--) {
      if ((k % 2) != 0) {
       for (sp = nosp; sp >= 1; sp--) {  // for the spacing factor.
        printf("  ");
       }
       for (r = 1; r <= k; r++) {
        printf("%2d", r-k);
       }
      }
      if ((k % 2) != 0) {
       printf("\n");
       nosp++;
      }
     }
     return 0;
    }

    Download Code

    Explanation:This can be seen as a diamond composed of numbers. If we use the conventional nested for loop for its construction the numbers can be seen to flowing the following function f(x) -> j-i
    where
    j= inner loop index
    i= outer loop index
    Back to top

    End of Question6 Start of Question7

  13. Write a C program to print the following pattern:
    77777777777
             7
            7
           7
          7
         7
        7
       7
      7
     7
    7
  14. Program:

    #include <stdio.h>
    
    int main(void) {
     int i, j;
     for (i = 11; i >= 1; i--) {
      for (j = 1; j <= i; j++) {
       if (i == 11) {
        printf("7");  // Makes sure the base is printed completely
        continue;
       } else if (j == i) { // Hollows the rest
        printf("7");
       } else {
        printf(" ");
       }
      }
      printf("\n");
     }
     return 0;
    }

    Download Code

    Explanation: This can be seen as a hollow right-angled triangle composed of 7′s
    Back to top

    End of Question7 Start of Question8

  15. Write a C program to print the following pattern:
     1                       1
     1 0                   1 0
     1 0 1               1 0 1
     1 0 1 0           1 0 1 0
     1 0 1 0 1       1 0 1 0 1
     1 0 1 0 1 0   1 0 1 0 1 0
     1 0 1 0 1 0 1 0 1 0 1 0 1
     1 0 1 0 1 0   1 0 1 0 1 0
     1 0 1 0 1       1 0 1 0 1
     1 0 1 0           1 0 1 0
     1 0 1               1 0 1
     1 0                   1 0
     1                       1
  16. Program:

    #include <stdio.h>
    
    int main(void) {
        int i,j,k,s,nos=11;
        for (i=1; i<=7; i++) {
            for (j=1; j<=i; j++) {
                if ((j%2)!=0) {   // Applying the condition
                    printf(" 1");
                } else {
                    printf(" 0");
                }
            }
            for (s=nos; s>=1; s--) {  // Space factor
                printf("  ");
            }
            for (k=1; k<=i; k++) {
                if(i==7 && k==1)  // Skipping the extra 1
                {
                    continue;
                }
                if ((k%2)!=0) {  // Applying the condition
                    printf(" 1");
                } else {
                    printf(" 0");
                }
            }
            printf("\n");
            nos=nos-2;  // Space Control
        }
         nos=1;
         for ( i=6; i>=1; i--) {  // It shares the same base
             for (j=1; j<=i; j++) {
                 if (j%2!=0) {
                     printf(" 1");
                 } else {
                     printf(" 0");
                 }
             }
             for(s=nos; s>=1; s--)  // Spacing factor
             {
                 printf("  ");
             }
             for (k=1; k<=i; k++) {
                 if (k%2!=0) {
                     printf(" 1");
                 } else {
                     printf(" 0");
                 }
             }
             printf("\n");
             nos=nos+2;
         }
        return 0;
    }

    Download Code
    Back to top

    End of Question8 Start of Question9

  17. Write a C program to print the following pattern:
    1
    2 4
    3 6 9
    2 4
    1
  18. Program:

    #include <stdio.h>
    int main(void) {
        int i,j;
        for (i=1; i<=3 ; i++) {
            for (j=1; j<=i; j++)  {
                printf("%2d", (i*j));
            }
            printf("\n");
        }
        for (i=2; i>=1; i--) { // As they share the same base
            for (j=1; j<=i; j++)  {
                printf("%2d",i*j);
            }
            printf("\n");
        }
        return 0;
    }

    Download Code

    Explanation: This can be seen as two right angle triangles sharing th same base
    The numbers are following the following function f(x) = i *j
    where
    i = Index of the Outer loop
    j = Index of the inner loop
    Back to top

    End of Question9 Start of Question10

  19. Write a C program to print the following pattern:
     1
     1 0
     1 0 0
     1 0 0 0
     1 0 0 0 0
     1 0 0 0 0 0
     1 0 0 0 0 0 0
     1 0 0 0 0 0
     1 0 0 0 0
     1 0 0 0
     1 0 0
     1 0
     1
  20. Program:

    #include <stdio.h>
    
    int main(void) {
        int i,j;
        for (i=1; i<=7; i++) {
            for (j=1; j<=i; j++) {
                if (j==1) {           // Applying the condition
                    printf(" 1");
                } else {
                    printf(" 0");
                }
            }
            printf("\n");
        }
        for (i=6; i>=1; i--) {  //As it shares the same base i=6
            for (j=1; j<=i; j++) {
                if (j==1) {   // Applying the condition
                    printf(" 1");
                } else {
                    printf(" 0");
                }
            }
            printf("\n");
        }
        return 0;
    }

    Download Code

    Explanation: This can be seen as two right angle triangles sharing the same base which is composed of 0′s n 1′s. The first column is filled with 1′s and rest with 0′s
    Back to top End of Question10

Over 1600 professionals follow Interview Mantra.


About the Author:  This post was written by Utsav Banerjee. You can reach Utsav on email at fugitiveland@gmail.com


  • Miley Shah

    I want dis pattern using while loop plzz

  • Payalpokar

    plz give me code for following

                          1
                    1   0   1
                 1  0 0 0 1
            1  0  0  0  0 0 1

  • Payalpokar

    give code for following

    *  *  *  *  *
    *  *      *  *
    *               * 
    *  *      *  *
    *  *  *  *  *

  • Nikunjkheni771

    void main()
    {
    int i,j;
    for(i=1; i<=4; i++)
    {
    for(j=1; j<=i; j++)
    {
    printf("*");
    }
    printf("n");
    }
    getch();
    }

  • Nikunjkheni771

    7 8 9 10
    4 5 6
    2 3
    1

  • Aadobariya127

    * *
    * *
    *
    * *
    * *

    codding for this pattern.

  • aa

    *       *
      *   *
        *
      *  *
    *       *

  • Bongo

    #include
    #include
    void main()
    {
    printf(“A1nB2,C3nD4E5F6nG7H8I9J10n”);
    getch();
    }

  • Raj

    The code for problem 8 is unnecessary long. This is an alternative code.  Please report any errors:

    #include#include int find(int n) { if(n%2==0) return 0;   else return 1;  }  main()  { int i,j,start=2,end=12;    clrscr();    for(i=1;i<=6;i++)    {      for(j=1;j<start;j++)      cout<<find(j)<<" ";            //for top half      for(j=start;j<=end;j++)      cout<<"  ";      for(j=end+1;j<=13;j++)      cout<<find(j)<<" ";      start++; end–; cout<<endl;    }     for(j=1;j<=13;j++)     cout<<find(j)<<" ";               //for middle row     cout<<endl;      start=end=7;      for(i=8;i<=13;i++)    {      for(j=1;j<start;j++)      cout<<find(j)<<" ";      for(j=start;j<=end;j++)              //for bottom half      cout<<"  ";      for(j=end+1;j<=13;j++)      cout<<find(j)<<" ";      start–; end++; cout<<endl;    }      getch();      }

  • Ravikumar

    write a c program to print the numbers in the given below formatt?

    4                                                     4
       3                                              3
           2                                      2
                1                            1
                              0
                 1                         1
            2                                      2
       3                                                  3
    4                                                          4
     

  • bharat

    #includevoid main(){int num=1, rows;printf(“Enter number of rows: “);scanf(“%d”, &rows);do{printf(“%dn”,num);num*=11;}while(rows>0);getch();}

    Like
    Reply

  • Bala Saidulu

    main()
    {
    int i,j,n,k;
    clrscr();
    for(i=1;i<=4;i++)
    {
    for(j=1;j<=4-i;j++)
    printf(" ");
    for(k=1;k<=i;k++)
    printf("%d",i);
    printf("n");
    }
    getch();
    }

  • CDDUUUUUUUUUUUUUUUUUUUU…

    its a simple one and important one also …………..

  • Hiral

    plz tell me this pattern code
    A
    1 2
    B C D
    3 4 5 6

  • Bijal

    give me code for this output-
    *****
    *       *
    *       *
    *       *
    *****

  • Bijal

    Give me a code fot this output:-
    *****
    *       *
    *       *
    *       *
    *****

  • Nipunrohatgi_91

    4444
    444
    44
    4

  • Sagar

    pls give me code for the pattern

    1     2     3     4     5
    16  17  18   19   6               
    15  24  25  20  7               
    14  23  22  21   8
    13  12  11   10   9
              

  • Omkar T

    #include
    void main()
    {
       int i,j,r;
       int alpha=65, num=1;
       clrscr(); 

       printf(“Enter rows(r):”); // rows!
       scanf(“%d”,&r); //if u give 4

       //logic
       for(i=1 ; i<=r ; i++)//rows
       {
             for(j=1 ; j If you want anymore help
    you can catch me on facebook or at my blog
    http://www.facebook.com/omkar.onkygadu
    http://omkar2u.wordpress.com.

  • Omkar T

    In open source program in the sense what?

  • Omkar T

    #include
    void main()
    {
      int i, j, r, c;
      int p=1;
      clrscr();

      printf(” nEnter rows(r):”)
      scanf(“%d”,&r); // 4
      printf(“nEnter cols(c):”);
      scanf(“%d”,&c); //3

     for(i=1 ; i<=r; i++) //rows 
    {
         for(j=1 ; j<=c ; j++) //cols
             if(  p%2 != 0 )
             {
                 printf("X");
                 p++;
              }
             else if( p % 2 == 0 )
             {
                 printf("O");
                  p++; 
              }
       
         printf("n");
     }

    getch();
    }

    // if u want more help visit my blog or 
    catch me on facebook!
    http://omkar2u.wordpress.com.
    http://www.facebook.com/omkar.onkygadu.
      

  • guest

    pls help me with the code of following pattern
     1234321
        23432
           343
              4

  • Omkar T

    #include
    void main()
    {
      int i, j, r, k ;
      clrscr();

      printf(“Enter no.of rows(r):”);
      scanf(“%d”,&r); //6

      for( i=0, k=0 ; ( k<=r && i<=r );  i++, k++ ) //rows
      {
           if ( k==3)
           {
               k = -1 ;
               continue;
            }
         for( j=0; j<=i ; j++) //cols
             printf( "%2d", k );  
        
         printf("n");
      }

    getch();
    }

    If u want more help! catch me on facebook or at my blog!
    http://www.facebook.com/omkar.onkygadu.
    http://omkar2u.wordpress.com.

  • Omkar

    #include
    void main()
    {
      int i, j, r;
      clrscr();

      printf(“Enter rows(r): “);
      scanf(“%d”, &r); //4

      for( i= 1; i<=r;  i++ ) //rows
      {
         for( j=1;  j<=(r+1)-i ; j++ ) //cols
                printf(" 4 ");
         printf("n");
       }

      getch();
    }

    // For more help catch me on facebook, or at my blog!
    http://www.facebook.com/omkar.onkygadu.
    http://omkar2u.wordpress.com.

  • Subhajit goswami

    i want to download

  • Subhasish Dutta

    plz help with dis pattern of numbers-
                  1
                2 4
              3 5  7
            6 8 10 12

  • Abhishek

    #include
    #include
    main()
     {
        int i,j,n,a,b,c,d,e,f;
        clrscr();

        printf(“nenter the no”);
        scanf(“%d”,&n);
        a=n*n-(n-2)*(n-2);
        d=a-1;
        b=a-(n-2);
        c=n*n-(n-4)*(n-4);
        e=n;
        f=c-1;

        for(i=1;i<=n;i++)
        {

            for(j=1;j3))
                    {
                        if(j==1)
                            printf(“%dt”,d++);
                        else if(j==n)
                            printf(“%dt”,n+2);
                        else if(j==n-1)
                            printf(“%dt”,a++);
                        else
                            printf(“%dt”,c++);
                    }
                else if(i==(n-1)&&(n>4))
                {
                    if(j==1)
                        printf(“%dt”,d-2);
                    else if(j==n)
                        printf(“%dt”,n+3);
                    else
                        printf(“%dt”,f–);
                }
                else if(i==n)
                        printf(“%dt”,b–);
            }
            printf(“n”);
        }
        getch();
    }

  • Abhishek

     plz… remove which is by mistake writtn in end….
    and it work for n=1,2,3,4,5……

  • Abhishek

     #include
    #include
    {
        int i,j,n,a,b,c,d,e,f;
        clrscr();

        printf(“nenter the no”);
        scanf(“%d”,&n);
        a=n*n-(n-2)*(n-2);
        d=a-1;
        b=a-(n-2);
        c=n*n-(n-4)*(n-4);
        e=n;
        f=c-1;

        for(i=1;i<=n;i++)
        {

            for(j=1;j3))
                    {
                        if(j==1)
                            printf(“%dt”,d++);
                        else if(j==n)
                            printf(“%dt”,n+2);
                        else if(j==n-1)
                            printf(“%dt”,a++);
                        else
                            printf(“%dt”,c++);
                    }
                else if(i==(n-1)&&(n>4))
                {
                    if(j==1)
                        printf(“%dt”,d-2);
                    else if(j==n)
                        printf(“%dt”,n+3);
                    else
                        printf(“%dt”,f–);
                }
                else if(i==n)
                        printf(“%dt”,b–);
            }
            printf(“n”);
        }
        getch();
    }

  • Abhishek

     it work for n=1,2,3,4,5…

  • userbadshah

    7777777
    7               7
    7               7 
    7               7 
    7               7 
    7               7 
    7777777
                      7777777
                      7               7
                      7               7 
                      7               7 
                      7               7 
                      7               7 
                      7777777 
                                       7777777                                   7               7                                   7               7                                    7               7                                    7               7                                    7               7                                    7777777 
                                                         7777777                                                     7               7                                                     7               7                                                      7               7                                                      7               7                                                      7               7                                                      7777777                                                                        7777777                                                                       7               7                                                                       7               7                                                                        7               7                                                                        7               7                                                                        7               7                                                                        7777777                                                                                          7777777
                                                                                             7               7
                                                                                             7               7 
                                                                                             7               7 
                                                                                             7               7 
                                                                                             7               7 
                                                                                             7777777
                                                                                                               7777777                                                                                                           7               7                                                                                                           7               7                                                                                                            7               7                                                                                                            7               7                                                                                                            7               7                                                                                                            7777777it might be easy but it seems like m doing it wrong.anyone want to solve this one? 

  • Userbadshah

    Really sorry for the below post.. i typed correctly but webpage adjusts it and made it wrong.

    7777777
    7               7
    7               7 
    7               7 
    7               7 
    7               7 
    7777777
                      7777777
                      7               7
                      7               7 
                      7               7 
                      7               7 
                      7               7 
                      7777777 
    the 7 block goes 7 times so pattern will look like stairs .
    anyone want to code that?

  • harsh

    i want code for above pattern immediately plz help..

    1 10 100 100…..
      4 49 499…
       53…. 

  • Harsh

    i want code for above pattern immediately plz help..

    1 10 100 1000…..  4 49 499…   53…. 

  • Harshal Sawant

    i want code for above pattern immediately plz help..

    1 10 100 1000…..  4 49 499…   53…. 

  • gopal

     please give the code to this pattern
    ——–1
    ——1—1
    —-1—2—1
    –1—3—3—1
    1—4—6—4—1

  • Kritiar10

    Sir,cud u plz help m fig. out the programming code for the pattern                                                          
    55555
    54444
    54333
    54322
    54321

  • Parthshah043

    #include
    #include
    main()
     {
        int i,j,n,a,b,c,d,e,f;
        clrscr();

        printf(“nenter the no”);
        scanf(“%d”,&n);
        a=n*n-(n-2)*(n-2);
        d=a-1;
        b=a-(n-2);
        c=n*n-(n-4)*(n-4);
        e=n;
        f=c-1;

        for(i=1;i<=n;i++)
        {

            for(j=1;j3))
                    {
                        if(j==1)
                            printf(“%dt”,d++);
                        else if(j==n)
                            printf(“%dt”,n+2);
                        else if(j==n-1)
                            printf(“%dt”,a++);
                        else
                            printf(“%dt”,c++);
                    }
                else if(i==(n-1)&&(n>4))
                {
                    if(j==1)
                        printf(“%dt”,d-2);
                    else if(j==n)
                        printf(“%dt”,n+3);
                    else
                        printf(“%dt”,f–);
                }
                else if(i==n)
                        printf(“%dt”,b–);
            }
            printf(“n”);
        }
        getch();
    }

    prepaid by :- parth shah….

  • m0na

    i m not getting the result like this .. plz help me out soon

  • Indu

    how to write o prog for this pattern…..
    1
    -1 0 1
    -2 -1 0 1 2

  • Indu

    how to write a prog for this pattern…..
    1
    -1 0 1
    -2 -1 0 1 2

  • Manash Kumar

    hi,

    I want print the o/p
    097
    0097
    00097
    000097
    so on
    but can’t do this plz help me.

    another pattern is

    097,
    098
    099
    0997,
    0998
    0999
    09997

    i also con’t do this plz help me.

    Thanx

    Manash Kumar

  • Jayshree

    plz help me with this pattern
    13579
    35791
    57913
    79135
    91357

  • Mehul

    b b b a b b b
    b b a a a b b
    b a a a a a b
    a a a a a a a

    try this program if user input 4

  • kushal maniyar

    1234
    765
    89
    10

  • kushal maniyar

    *

    **

    * *

    * *

    * *

    * *

    * *

    * *

    * *

    **

    *

  • kushal maniyar

    * * * * * *

    * *

    * *

    * *

    * *
    * * * *

  • shweta

    1 2 3
    4 5

    10 9 8 7
    6

    11 12 13 14 15

    20 19 18 17 16

    plzz help out can nyone give code for following pattern for n=5

  • shweta

    1 2 3
    4 5

    10 9 8 7
    6

    11 12 13 14 15

    20 19 18 17 16

  • shweta

    1 2 3 4 5
    10 9 8 7 6
    11 12 13 14 15
    20 19 18 17 16

Previous post:

Next post: