Advertisement
mbratanov

05. Primary Diagonal - no matrix

Sep 18th, 2024
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. # Read input
  2. n = int(input())
  3. diagonal_sum = 0
  4.  
  5. # Logic
  6. for index in range(n):
  7.     row_data = [int(num) for num in input().split()]
  8.     diagonal_sum += row_data[index]
  9.  
  10. # Print output
  11. print(diagonal_sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement