Search C Program | nimishsoft@gmail.com

Number Pattern - 34

             1
           2 3
         4 5 6
      7 8 9 10
11 12 13 14 15

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


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


14 comments:

  1. *
    *1
    **2
    ***3
    ****4
    Pls provide suitable solution

    ReplyDelete
    Replies
    1. int main()
      {
      int i, j;
      for(i=1;i<=5;i++)
      {
      for(j=1;j<=i;j++)
      {
      if(j<i || j==1)
      printf("*");
      else
      printf("%d",j-1);
      }
      printf("\n");
      }

      return 0;
      }

      Delete
  2. #include

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

    ReplyDelete
    Replies
    1. I agree .Given programme me condition if(j<=i) aana chahiye.

      Delete
  3. #include

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

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

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

    for(j=1;j<=i;j++,k++)
    {
    printf("%2d ",k);
    }

    printf("\n");
    }

    return 0;
    }

    ReplyDelete
  4. Replies
    1. #include
      void main()

      {
      int i,j,k=1;
      for(i=1;i<=4;i++)
      {
      for(j=1;j<=i;j++)
      {
      printf("%d",k++);
      }
      printf("\n");
      }
      }

      Delete
  5. 1
    2 3
    4 5 6
    7 8 9 10
    11 12 13 14 15
    16 17 18 19 20 21
    22 23 24 25 26 27 28
    29 30 31 32 33 34 35 36
    37 38 39 40 41 42 43 44 45
    46 47 48 49 50 51 52 53 54 55
    56 57 58 59 60 61 62 63 64 65 66
    67 68 69 70 71 72 73 74 75 76 77 78
    79 80 81 82 83 84 85 86 87 88 89 90 91
    92 93 94 95 96 97 98 99 100 101 102 103 104 105
    106 107 108 109 110 111 112 113 114 115 116 117 118 119 120


    Code for this pls

    ReplyDelete
  6. #include
    void main()

    {
    int i,j,k=1;
    for(i=1;i<=15;i++)
    {
    for(j=1;j<=i;j++)
    {
    printf("%d",k++);
    }
    printf("\n");
    }
    }

    ReplyDelete