Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
Answer / Rajani Sachan
In C, you can implement this as follows:n```cnint i, j, sum_upper = 0, sum_lower = 0;nfor (i = 0; i < M; i++) {n for (j = i + 1; j < N; j++) {n if (i < j) {n sum_upper += matrix[i][j];n } else if (i > j)n sum_lower += matrix[j][i];n }n}nprintf("Upper diagonal: %d
Lower diagonal: %d
", sum_upper, sum_lower);n```
| Is This Answer Correct ? | 0 Yes | 0 No |
What type of function is main ()?
Tell me what is the purpose of 'register' keyword in c language?
Is c is a high level language?
write a c programs to do multiplication of two numbers with out using arithmatic operator ??????????
WHAT IS HEADER?
What is the function of volatile in c language?
What is the -> in c?
Differentiate b/w Modify and Update commands giving example.
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
to get a line of text and count the number of vowels in it
What is the explanation for prototype function in c?
write a c program to print a given number as odd or even without using loop statements,(no if ,while etc)