Multidimensional Array_1.2

#include <stdio.h>
int main()
{
    int a[25][25],i,j,k=0;
    for(i=1;i<=4;i++)
    {
      for(j=1;j<=i;j++)
      {
         a[i][j]=k;
      }
       k++;
    }

    for(i=1;i<=4;i++)
    {
      for(j=1;j<=i;j++)
      {
          printf("%d",a[i][j]);
      }
          printf("\n");
    }
    system("pause");
    return 0;
}


This is the output:
0
11
222
3333

0 comments:

Post a Comment