Advertisement
mbratanov

05. Primary Diagonal - Single Loop

Sep 18th, 2024
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 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 = input().split()
  8.     diagonal_sum += int(row_data[index])
  9.  
  10. # Print output
  11. print(diagonal_sum)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement