Friday, 20 January 2012

Can array be 3-dimensional??? yes it can be 3,4,5-d but v can imagine the elements 3-d to the max.........


#include<stdio.h>
#include<conio.h>
void main()
{
int a[20][20][20];
int i,j,k,n,m,o;
clrscr();
printf("ENTER THE ROW OF THE ARRAY\n");
scanf("%d",&m);
printf("ENTER THE COLUMN OF THE ARRAY\n");
scanf("%d",&n);
printf("ENTER THE BREADTH OF THE ARRAY\n");
scanf("%d",&o);
printf("ENTER THE ELEMENTS OF THE ARRAY ONE BY ONE\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<o;k++)
scanf("%3d",&a[i][j][k]);
}

}
printf("THE ELEMENTS ARE\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<o;k++)
{
printf("%3d",a[i][j][k]);
printf("\n");
}
}
printf("\n");
}

getch();
}

No comments:

Post a Comment