Sum of Major and Minor Diagonal Elements C Program

 

C Program To Find Sum of Major and Minor Diagonal Elements of Matrix

Here, we have listed How To Calculate Sum of Major and Minor Diagonal Elements of a Matrix in C Programming Language. It is important that we should know How A For Loop Works before getting further with the C Program Code.

What are Major Diagonal Elements of a Matrix?

The Major Diagonal Elements are the ones that occur from Top Left of Matrix Down To Bottom Right Corner. The Major Diagonal is also known as Main Diagonal.

 

What are Minor Diagonal Elements of a Matrix?

The Minor Diagonal Elements are the ones that occur from Top Right of Matrix Down To Bottom Left Corner.

Also Read: C Program To Calculate Sum of Array Elements

Method 1: Find Sum of Major Diagonal Elements in C Programming

   

Output

C Program To Find Sum of Major and Minor Diagonal Elements of a Matrix

C Program To Find Sum of Minor Diagonal Elements

   

Output

C Program To Find Sum of Minor Diagonal Elements of a Matrix

In case you get any Compilation Errors with this C Program Code To Find Major and Minor Diagonals of Matrix or if you have any doubt about it, mention it in the Comment Section.

6 thoughts on “Sum of Major and Minor Diagonal Elements C Program

  1. Derek Brian

    Excellent Program! Thanks! Every other program that I came across was very confusing! You have specified correctly the difference between Major and Minor Diagonals.

    Reply
  2. Ajay Sawant

    Phew!! Finally I got a correct working c program code on finding sum of major diagonals and minor diagonals and that too with explanation.

    Reply
  3. Vivek Rathod

    I was getting confused on which is Major Diagonal and which is Minor Diagonal. Thanks for the briefing above.

    Reply
  4. Vishnu

    minor diagonal formula is wrong it will not work for -ve no’s .

    Reply
  5. Klingon46

    Major diagonal = from top-left to bottom-right
    Minor diagonal = from top-right to bottom-left

    Actually the values you used for filling your matrix are very badly chosen because you made a magic square, which is to say a 3×3 matrix whose diagonals and middle line and column sum up to the same value (15) so it does not prove it works at all.

    Reply

Let's Discuss