You have set the outer most while loop up as an infinite loop with no way to get out of it. Between lines 33 and 36 you could add an if statement, maybe check the value of solution and if it becomes larger than some given amount then break out of the loop. Or change the condition of the while loop so that it will run a finite number of times.
Check the value of c @line 35 and also col @line 47 and 48. You should find that neither one will reach -1, so the exit statement is never reached and you have an endless while loop. I also notice that the program will print six lines with the only difference being the last number then it repeats. With out some way to limit the while loop it is an endless loop.
The last time I let the program run the solution# went above 10000 before I stopped it.