-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayborder.c
More file actions
31 lines (31 loc) · 855 Bytes
/
Copy patharrayborder.c
File metadata and controls
31 lines (31 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<stdio.h>
int main(){
int rows,column;
printf("enter num of rows of array\n");
scanf("%d",&rows);
printf("enter num of columns of array\n");
scanf("%d",&column);
int arr[rows][column];
printf("enter the elements in 2d array\n");
for (int i=0;i<rows;i++){
for (int j=0;j<column;j++){
scanf("%d",&arr[i][j]);
}
}
printf("\nthe 2d array /matrix is:\n\n");
for (int i=0;i<rows;i++){
for (int j=0;j<column;j++){
printf("%d ",arr[i][j]);
}printf("\n");
}
printf(" the border element\n");
for (int i=0;i<rows;i++){
for (int j=0;j<column;j++){
if(i==0||j==0||i==rows-1||j==column-1){
printf("%d ",arr[i][j]);
}else{
printf(" ");
}
}printf("\n");
}return 0;
}