Array Program9 Multi-dimensional array.

#include<stdio.h>

#include<conio.h>


void main()

{

int i, j, k, limit1, limit2, limit3, a[97][9][9], max;

clrscr();


printf("How many numbers you want as limit1? ");

scanf("%d", &limit1);


printf("How many numbers you want as limit2? ");

scanf("%d", &limit2);


printf("How many numbers you want as limit3? ");

scanf("%d", &limit3);


printf("\nEnter numbers for 3-D Array A\n");

for(i=0; i<limit1; i++)

{

for(j=0; j<limit2; j++)

{

for(k=0; k<limit3; k++)

{

printf("Enter number %d %d %d: ", i+1, j+1, k+1);

scanf("%d", &a[i][j][k]);

}

}

}


printf("\nYour elements are\n\n");

for(i=0; i<limit1; i++)

{

for(j=0; j<limit2; j++)

{

for(k=0; k<limit3; k++)

{

printf("%d ", a[i][j][k]);

}

}

}


getch();

}


No comments:

Post a Comment