Insert and display number in 2d array using c

2D Array in C:

#include<stdio.h>

/* run this program using the console pauser or add your own getch, system(“pause”) or input loop */

int main(int argc, char *argv[]) {

int array[3][3];
int row,col;

for(row=0;row<3;row++){
for(col=0;col<3;col++){
printf(“enter value : “);
scanf(“%d”,&array[row][col]);
}
}

for(row=0;row<3;row++){
for(col=0;col<3;col++){

printf(“%d\t”,array[col][row]); }
printf(“\n”);

}

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *