Pregunta de entrevista de Innovacx

Can you write and explain the program about adding the diagonal elements in array (we should consider one element at once)