About 500,000 results
Open links in new tab
  1. C Program to Compute the Sum of Diagonals of a Matrix

    Aug 1, 2022 · In this article, we will learn how to find the sum of elements of an array using a C program. The simplest method to calculate the sum of elements in an array is by iterating …

  2. Diagonal Traversal of a Matrix I - GeeksforGeeks

    May 8, 2025 · Given a 2D matrix of size n*m, the tasks is to print all elements of the given matrix in diagonal order. Example: Input: mat[][] = [[ 1, 2, 3, 4 ], [5, 6, 7, 8 ], [9, 10, 11, 12], [13, 14, …

  3. Maximize sum by traversing diagonally from each cell of a …

    Dec 1, 2022 · Approach: To solve this problem, the idea is to traverse the matrix diagonally for first row and column elements and sum up their diagonal elements within the range of the …

  4. MATDIAGSUM - Editorial - CodeChef Discuss

    Mar 16, 2024 · Problem: Given a N x N square matrix, find the sum of both primary as well as secondary diagonal elements. Solution Approach: We iterate through the rows of the matrix, …

  5. c - Traverse Matrix in Diagonal strips - Stack Overflow

    public static void printSecondaryDiagonalOrder(int[][] matrix) { int rows = matrix.length; int cols = matrix[0].length; int maxSum = rows + cols - 2; for (int sum = 0; sum <= maxSum; sum++) { for …

  6. C Program to find Sum of Diagonal Elements of a Matrix

    C Program to find Sum of Diagonal Elements of a Matrix. This program allows the user to enter the number of rows and columns of a Matrix. Next, we are going to calculate the sum of …

  7. GitHub - nidhiupman568/Codechef-Problem-Solved: Hi! I'm Nidhi …

    Graph traversal: BFS 🔄, DFS 🔍; Shortest path algorithms: Dijkstra's 🛤️, Floyd-Warshall 🌐; Minimum spanning tree: Kruskal's 🌳, Prim's 🌿

  8. leetcode-gfg-codechef-problem-solution/1572. Matrix Diagonal Sum ...

    Contribute to abhayt21/leetcode-gfg-codechef-problem-solution development by creating an account on GitHub.

  9. c - Sum of the diagonal in a 2 dimensional array - Stack Overflow

    Mar 29, 2014 · For a non-square matrix if you want to sum the elements at position with equal row and column number you can do: sum += matrix[i][i] So a single for loop is the only way? …

  10. C Exercises: Find the sum of left diagonals of a matrix

    Mar 18, 2025 · sum = sum + arr1[i][j]; // Adding elements on the left diagonal. // Display the sum of left diagonal elements. printf("Addition of the left Diagonal elements is : %d\n", sum); return 0; …

  11. Some results have been removed
Refresh