program to make spiral matrix

Home Forums C Programming program to make spiral matrix

Viewing 3 reply threads
  • Author
    Posts
    • #2152
      KerriReeks
      Participant

      hi !!!
      i want to make a program for spiral matrix………i have exactly no idea how to code..
      spiral matrix is like this::if input is 4

      1 2 3 4
      12 13 14 5
      11 16 15 6
      10 9 8 7

    • #3473
      GWILouisaxwzkla
      Participant

      Can you give a definition of spiral matrix?

    • #3474
      KerriReeks
      Participant

      firstly tell me u r that cman?

      ya spiral matrix is like as i have given inthe question.in it i f the input is 4,then it will print the numers in 4 row and 4 column.just like a coil structure.

      it will print 1 2 3 4,then it will go to 4th column and print 5
      6
      7
      and so on…….in my previous post u can c that.although it seems not clear in it.
      try to understand that matrix by observing the figure u can understand

    • #3475
      GWILouisaxwzkla
      Participant

      I think this does what you want it to:

      heres the ouput:

      enter the size of the matrix: 5

      1 6 11 16 21
      2 7 12 17 22
      3 8 13 18 23
      4 9 14 19 24
      5 10 15 20 25
      Press any key to continue

Viewing 3 reply threads
  • You must be logged in to reply to this topic.