Asked by nakul
write a c programs to find the trace of a given matrix.
Answers
Answered by
Anonymous
for an integer matrix,
int trace(int *a,int n) {
int t=0,i;
for (i=0;i<n;i++) {t += *(a[i*n+i])}
return t;
}
int trace(int *a,int n) {
int t=0,i;
for (i=0;i<n;i++) {t += *(a[i*n+i])}
return t;
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.