Sign InCreate Account

Upgrade to Pro

Upgrade Now

Coding Workspace

EditorProjectsPractice QuestionsTimed Mock ExamsFlowcharts

PseudoEditor AI

Pseudocode TutorCode GeneratorCode FixerCode Converter
Back to Problems
PreviousNext

Sign in to run tests against edge cases and save your code automatically.

Problem Description

Medium

Grid Diagonal Sums

PRO1D & 2D Arrays
2D Arrays

A 3 x 3 grid of integers is stored in a 2D array. Write a program that inputs 9 integers **row by row** (the first three inputs fill row 1, the next three fill row 2, and so on). Output two lines: 1. The sum of the main diagonal (top-left to bottom-right). 2. The sum of the anti-diagonal (top-right to bottom-left). For example, the grid 1 2 3 / 4 5 6 / 7 8 9 has a main diagonal sum of 15 and an anti-diagonal sum of 15.

Example Input

1 2 3 4 5 6 7 8 9

Example Output

15 15

Success Rate:

0% (0 passed / 0 attempted)

Code

Draft auto-saved

Test Results

Click "Test Code" to evaluate your code against the tests.

Product

For SchoolsOverviewFeaturesFAQ
PseudoEditor

© 2026 PseudoEditor. All rights reserved.