Search C Program | nimishsoft@gmail.com

Number Pattern - 30

    1
   21
  321
 4321
54321

#include<stdio.h>

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


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


18 comments:

  1. its show there is 1 error plz solve it

    ReplyDelete
  2. can u plz xplain 'i' and 'j'. here wat is 'i' and wat is 'j'?

    ReplyDelete
    Replies
    1. both are loop counter variables. i for outerloop and j for inner loop

      Delete
  3. not correct
    because not use of the variable k

    ReplyDelete
  4. thank for your code for better guide.

    ReplyDelete
  5. #include

    int main()
    {
    int r,i,j;

    printf("Enter the no. of rows : ");
    scanf("%d",&r);

    for(i=1;i<=r;i++)
    {
    for(j=1;j<=r-i;j++)
    {
    printf(" ");
    }

    for(j=i;j>=1;j--)
    {
    printf("%d",j);
    }

    printf("\n");
    }
    }

    ReplyDelete
    Replies
    1. wrong,function should return a value.
      write void instead of int or write return 0 at end

      Delete
  6. Replies
    1. #include
      #include
      main()
      {
      int i,j;
      for(i=1;i<=5;i++)
      {
      for(j=1;j<=i;j++)
      {
      printf("%d",j);
      }
      printf("\n");
      }
      }

      Delete
  7. 54321
    4321
    321
    21
    1

    I NEED THIS PROGRAM CODING

    ReplyDelete
  8. I need 1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5

    ReplyDelete
  9. Thank you so much!!! Love from Kerala <3

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. - - - 1
    - - 1 2
    - 1 2 3
    1 2 3 4

    in c

    ReplyDelete