photo

Erfan Pakdamanian


Con actividad desde 2018

Followers: 0   Following: 0

Estadística

  • First Answer

Ver insignias

Feeds

Ver por

Respondida
Write a function called spiral_diag_sum that takes an odd positive integer n as an input and computes the sum of all the elements in the two diagonals of the n-by-n spiral matrix.
function s= spiral_diag_sum(n) sp=spiral(n); s=sum(diag(sp))+sum(diag(fliplr(sp)))-1;

más de 6 años hace | 1