Search C Program

Loading...

Number Pattern - 35

    5
   54
  543
 5432
54321


int main()
{
  int i,j;
  for(i=5;i>=1;i--)
  {
    for(j=1;j<i;j++)
      printf(" ");
    for(j=5;j>=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


2 comments:

  1. #include

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

    ReplyDelete
    Replies
    1. #include
      int main()

      {
      int i,j,k=1,n;

      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
      k=n;
      for(j=n;j>=1;j--)
      {
      if(j>i)
      printf(" ");
      else
      printf("%d",k--);
      }
      printf("\n");
      }
      return 0;
      }

      Delete