brianf38
asked on
5x5 array
I need to make a 5x5 array. And then I have to find the sum of the left diagonal, the sum of the right diagonal, and the sum of the second row. How do I go about doing this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Damn! That looks like a 100-level CS class assignment. Summer school huh? If it indeed is for school kid, lemme tell you something. I was like you too...finding the easier way out, but I had to pay the price...now I would like to believe I am self sufficient, at least as far as what I am supposed to do is concerned. I say chap, dont look for easier way out. Good comment Lynn.
ASKER
Thank You Weeb0!
I'd recommend making a drawing of 5 small boxes across and 5 deep on a sheet of paper. Place numbers inside each of the 25 inner squares., then, for each of the 3 sums you want to find, do it manually and observe the steps you took to find the correct square and what you did with the number inside it. Convert those steps into lines of code in whichever programming language you're using and test it. Do this for one question at a time. If you are using subroutines (aka functions, methods, etc depending on the programming language), you can combine all 3 routines into your final version of the program.
HTH,
Lynn