Search C Program | nimishsoft@gmail.com

Number Pattern - 9

1
22
333
4444
55555

#include <stdio.h>

int main()
{
    int i, j;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d",i);
        }
        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. you have really helped us but please tell me what i and j stand for, please

    ReplyDelete
    Replies
    1. i for outer loop (rows)
      and j for inner loop (columns)

      Delete
  2. There are just loop variables. It is not a syntax, just a terminology for loop. You can choose any name for these you want !!!

    ReplyDelete
  3. Thanks for the program, but will you please explain following for loop conditions? means what happen when inner & outer loop executes?
    for(i=1;i<=5;i++)
    for(j=1;j<=i;j++)
    Thanks in advance

    ReplyDelete
  4. it's correct. Notice that printf has changed to print "i".

    ReplyDelete
  5. Please solve above number pattern by using while loop

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

      Delete
  6. Want the mirror of this patter

    ReplyDelete
  7. Write a C code to Print the following shapes:

    1) using scanf

    ReplyDelete
  8. Please tell me which one prints the num and which one prints the line inner loop or outer respectively.

    ReplyDelete
  9. i need the algorithm of this code

    ReplyDelete