Question: What's wrong with my if loop?

What's wrong with my loop? It works fine if no_legs is set to 3, but when it is set to 2 or 4 it doesn't work (as in the picture). The code is to list combinations, as in http://www.mapleprimes.com/questions/149475-How-Do-I-Create-Combinations-According. I'm really stuck. Thank you for any help!

 

 

Please Wait...