セクション 4. 章 3
single
Challenge: Sum of Main Diagonal
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
Write a function that calculates the sum of the main diagonal of a 2D integer array. The main diagonal consists of elements where the row index and column index are equal.
Requirements:
- Declare and initialize a 2D array in
main. - Pass the array and its size to a function.
- Use nested loops or direct indexing to access diagonal elements.
- Return the diagonal sum from the function.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 4. 章 3
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください