- 1

Guys, I need help, write the code in C#

Square spiral of numbers, in order, the beginning of the spiral should be from the middle. The user must enter the spiral height and the spiral tire.

5th May 2022, 9:24 AM
Oliver Tviste
Oliver Tviste - avatar
4 Answers
+ 2
Why is it urgent??? What have you tried? Can you please link your code? Have you looked at example codes yet?
5th May 2022, 11:17 AM
Lisa
Lisa - avatar
+ 2
I think you would benefit from doing some more practice with easier task before you attempt the more difficult ones. If you tried, you can show us your attempt, so we can suggest how to continue.
5th May 2022, 11:41 AM
Lisa
Lisa - avatar
0
Well, I really need it, I saw code examples, but I need just such one, I myself can’t write this (I tried), but if someone can, I will be glad and even happier if they can explain.
5th May 2022, 11:38 AM
Oliver Tviste
Oliver Tviste - avatar
0
You mean like: 9 - 8 - 7 2 - 1 - 6 3 - 4 - 5 Think: How do I want to store this? A square matrix perhaps? You know the size of the square and therefore the last number. You can calculate the centre position but is this the best starting place? What if you try starting from the top left corner and work around backwards. Do you notice anything? Add 3 numbers rightward then 2 down 2 left 1 up 1 right then done. Hmmm. Counting down may be useful. Question is there a generic pattern here? If so how would this be useful? How would you go about exploiting this pattern in the solution? Good luck. Post an attempt so we can provide better assistance. Hopefully this thought process will be of use to you.
7th May 2022, 12:58 AM
Adam McGregor