As Salem said it's utterly unwise to use/name variables which are not correctly identified (int a, b, c....).
If you used arrays you wouldn't have to define that many variables and you'd shorten your code to half of what you've got at the moment. Take a look at the code I posted on the other thread.
Programming isn't only about finding a solution, but the BEST solution and that is something you will be aware of later on.