Friday, 22 June 2012

write a c program for storage representation of 2D array


/*write a c program for storage representation of 2D array
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],i,j,temp;
clrscr();
printf("\nenter the element of matrix :\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\nthe display of matrix is :\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
getch();
}
/*
enter the element of matrix :                                                  
4 5 6                                                                          
7 8 9                                                                          
1 3 9                                                                          
                                                                               
the display of matrix is :                                                    
4       5       6                                                              
7       8       9                                                              
1       3       9                                                              
     */

No comments: