How to display the border elements of a 2 d array. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to display the border elements of a 2 d array.

just to display the elements at the sides of 2D array.. in 2D format.. WITHOUT STRING HEADER FILE..

31st Dec 2016, 11:55 AM
Mohd Sabahat
Mohd Sabahat - avatar
2 Answers
+ 1
like for A[n][n] for(i=0;i<n;i++) { for(j=0;j<n;j++) if((i==0||j==0)||((i==n-1)||(j==n-1)) cout<<A[i][j]; } all the elements on the border will be printed
31st Dec 2016, 2:36 PM
Dhairya Agarwal
Dhairya Agarwal - avatar
0
thank you very much dhairya...
1st Jan 2017, 5:52 AM
Mohd Sabahat
Mohd Sabahat - avatar