Search C Program | nimishsoft@gmail.com

Number Pattern - 1

1
12
123
1234
12345


#include <stdio.h>

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

14 comments:

  1. want mirror image of that pattern

    ReplyDelete
  2. please write code for this using while loop

    ReplyDelete
    Replies
    1. #include
      int main()
      {
      int i=1;
      while(i<=5)
      {
      int j=1;
      while(j<=i)
      {
      printf("%d", j);
      j++;
      }

      i++;
      printf("\n");
      }
      return 0;
      }

      Delete
  3. we want these coding by while and do while

    ReplyDelete
    Replies
    1. while :
      rows = 5
      i = 0
      while i <= rows:
      j = 1
      while j <= i:
      print(j, end=' ')
      j += 1
      print()
      i += 1

      do-while:
      rows = 5
      i = 0
      while True:
      j = 1
      while j <= i:
      print(j, end=' ')
      j += 1
      print()
      i += 1
      if i > rows:
      break

      Delete
  4. if it is in pyramid shape
    then the code will be...???

    ReplyDelete
  5. i really want someone explain :( i dont want just to copy and be proud of it, i have big conscience at my back

    ReplyDelete
  6. #include
    int main()
    {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    for(int j=1;j<=i;j++)
    {
    printf("%d ",j);
    }
    printf("\n");
    }
    return 0;
    }

    ReplyDelete
  7. #include
    int main()
    {
    int i=1;
    while(i<=5)
    {
    int j=1;
    while(j<=i)
    {
    printf("%d", j);
    j++;
    }

    i++;
    printf("\n");
    }
    return 0;
    }

    ReplyDelete