>i have a problem in programming
Pretty much every thread in this forum is based on a 'problem in programming', try to be more descriptive next time you make a new thread.
>how can i know the right logical solutions for the problem after reading it ??
That didn't make much sense to me. Is there a specific problem you're having, or is it just a really vague question? If there's an actual problem, post code and give more information.
To the OP:
As it has been said: Programming is an Art.
Some have god gifted talent in programming. Others develop their talent by practicing more problems.
It is simply not possible for us to solve this problem (of having non-logic mind in programming.)
Learn how to program is exercising, the more you exercise the better you'll be, but there aren't any tricks/rules to learn how to logically solve a problem (except abstraction, where you break a problem down to several easy to understand parts) ...
It is not a problem to write a code without errors , but the point is that either your goal for writing program is accomplished or not , for this thoroughly read the problem agian an gain until ou understand what u are supposed to do, then write its algorithm on paper , after that u are ready to code. Direct coding is not a good practice.
Logic is real understanding of what you are trying to accomplish , and the structure of arguments.
Analyze a problem, express its essence abstractly, sort through information, make connections, recognize patterns...
Your ambitions should comfort you in problem solving.