Search C Program | nimishsoft@gmail.com

Number Pattern - 51

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

int main ()
{
  int i,j,k;
  for (i=1;i<=5;i++)
  {
    for(k=i;k>1;k--)
      printf("%d ",k);
    for(j=1;j<=6-i;j++)
      printf("%d ",j);
    printf("\n");
  }
  return 0;
}


Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C


10 comments:

  1. #include
    #include

    int main()
    {
    int i, j;
    clrscr();
    for(i=1;i<=9;i=i+2)
    {
    for(j=10;j>=i;j=j-2)
    {
    printf("%d",j-i);
    }
    printf("\n");
    }


    getch();
    return 0;
    }

    ReplyDelete
  2. Develop a C program to print the following pattern.
    1 2 3 4 5
    10 9 8 7 6
    11 12 13 14 15
    20 19 18 17 16
    .........
    46 47 48 49 50

    ReplyDelete
    Replies
    1. // To generate the pattern

      #include

      void main()
      {
      int i, j, k=1, rows;
      printf("\n Enter number of rows : ");
      scanf("%d", &rows);

      for(j = 1; j <= rows; ++j)
      {
      for(i = 1; i <= 5; i++)
      printf("%4d", k++);
      printf("\n");
      }
      }

      Delete
  3. C program to generate the pattern

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

    how to do that sir?

    ReplyDelete
  4. NtaterXtioku_Bellevue Christopher Chartier click here
    setideli

    ReplyDelete