Why am I failing in a test case in problem Pattern Numbers and Stars 1?

This is my program link for this problem, please look at this, and let me know the problem.