Ask a Question

Write a program to create a diagonal matrix and print.

on 2012-10-15 17:43:05   by S   on MCA  2 answers

Arka

on 2012-10-15 09:30:00  

for(i=0;i

Rajni

on 2012-10-17 09:30:00  

void prtMatrixDiag(){ int i,j,a,b,reach = 0; for(i = 0; i < colomn; i++ ) { for(j = 0; j < row; j++) { a = i; if(reach) b = row+1; else b = j; while(a >= 0 && b >=0) { printf("%d ", mat[b][a]); b--; a++; if ((j+1) == row) reach = 1; } } } }