nt "Matrix is not a square"   Example: Input (The first line contains the number of rows and the second line contains the number of columns. The succeeding lines contains the values of the matrix) 3 3

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 7PP: (Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point...
icon
Related questions
Question

Using C Program and arrays,

 

Write a program that will give the sum of the main and opposite diagonal elements of a square matrix. If the matrix is not a square, print "Matrix is not a square"

 

Example:

Input (The first line contains the number of rows and the second line contains the number of columns. The succeeding lines contains the values of the matrix)

3

3

12 23 34

45 46 47

56 51 23

 

Output

217

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage