Search C Program | nimishsoft@gmail.com

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


4 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
  2. #include

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

    ReplyDelete
  3. I want to code
    Output aana chahiye

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

    ReplyDelete