program to make spiral matrix

Home Forums C Programming program to make spiral matrix

This topic contains 3 replies, has 2 voices, and was last updated by  GWILouisaxwzkla 9 years, 2 months ago.

  • Author
    Posts
  • #2152

    KerriReeks
    Member

    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

    Can you give a definition of spiral matrix?

  • #3474

    KerriReeks
    Member

    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

    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

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble