Multidimensional Array_1.1

#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
12
345
6789

0 comments:

Post a Comment