InterviewSolution
Saved Bookmarks
| 1. |
Write an algorithm to print all those elements of a matrix X[4 x 4] that are not diagonal elements |
|
Answer» Students I am giving you the program for printing Non Diagonal elements of a matrix X[4x4], try to convert this code into algorithm. #include<conio.h> #include<iostream.h> void accept(int a[4][4],int size) { cout<<"Diagonal One:"; for (int i=0;i<size;i++) for(int j=0;j<size;j++) if (i != j && i != size-j-1) cout<<a[i][j]; } void main() { int a[4][4]={{5,4,3,4},{6,7,9,1},{8,0,3,7},{2,4,5,9} }; clrscr(); accept(a,4); getch(); } |
|