Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !/bin/sh
- read N
- firstDiagonal=0
- secondDiagonal=0
- d=0
- for i in $(seq $N);
- do
- IFS=" "
- read -a line
- let firstDiagonal+=$((${line[$d]}))
- let secondDiagonal+=$((${line[(($N-$d-1))]}))
- let d+=1
- done
- result=$(($firstDiagonal-$secondDiagonal))
- echo ${result#-}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement