Search C Program

Loading...

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


1 comment:

  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