Search C Program

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


8 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