Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Read input
- n = int(input())
- matrix = []
- diagonal_sum = 0
- # Logic
- for index in range(n):
- row_data = [int(num) for num in input().split()]
- matrix.append(row_data)
- diagonal_sum += matrix[index][index]
- # Print output
- print(diagonal_sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement