Skip to content
Related Articles

Related Articles

I Can’t Use Logic In Programming. What Should I Do?

View Discussion
Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 21 Apr, 2022

Are you a new developer and recently stepped into programming? 

You might be getting frustrated when you see that you don’t get logic in programming and you don’t know how to start solving a specific problem. You see other developers are good at using their brains in programming and solving the coding question very quickly. It also happens that when someone else is explaining the same problem and its solution, you understand everything but when you try to solve the question on your own you get stuck there. 

It’s a common problem in beginners and they give up on programming because they think “programming is not my cup of tea”. You can’t deny that logic is the fundamental key to becoming a good developer. It doesn’t matter if you are a front-end developer or backend developer you need to use logic to solve a problem or optimize your code. Now the question is “why you don’t get the logic in programming and how to get better at programming logic?” 


The problem that most beginners are failed to understand is ” until or unless your brain won’t do a lot of practice it’s impossible to get the logic in programming.”. Take an example of a typist or a footballer. The reason why a typist is good at typing or a footballer is good in his game is because of practice. When you practice enough for something the response time is reduced for your brain and you eventually get the logic or solution for the problem. Practicing enough for the problems in programming makes you experienced and the more experience you will have the better programmer you’ll become. Also, you need to be patient enough not to leave it by thinking it is not your cup of tea

Understand that there is no shortcut to getting better at programming but there are some techniques and tips to get better at logic in programming. We are going to discuss those techniques but remember that all the techniques require practice, practice, and practice. and definitely patience 

1. Solve New Problems Every Day

The first piece of advice is once you solve a specific problem don’t repeat it more than three to four times. Three to four times is ok but then move to the next problem and face new challenges. Let’s say you are practicing printing different kinds of patterns, once you practice enough two or three times, move to the next coding challenge. Keep moving on and try to face a new problem every single day. Your brain has to prepare itself for the new challenge to reduce the response time and get the logic in programming. Solving a problem by print even and odd numbers multiple times for a couple of days won’t help you in programming. Learn new things every day, this will also give you exposure to real-life problems and it will help you to write code for new challenging situations or problems. 

2. Keep Moving On Level By Level

When you start doing programming start with the easy problem from some resources and then move to the next level. Practice enough for a variety of questions at the easy level, then move to some complex program (intermediate level questions) and try to solve a variety of questions for this level. Again move to the next level or more complex problem (hard level questions) and solve a lot of problems. A lot of websites are there like GeeksforGeeks, HackerRank, Codewars, and CodinGame to practice and improve the logic in programming level by level. 

3. Divide Problems into Smaller Chunks

When you are given a problem firstly try to understand the complete problem and find out what exactly needs to be done. Think about the problem carefully and write down on paper what steps you need to take to solve a specific problem. Think about all the case scenarios and steps, and according to that write down the input or variables that you need to take to solve the problem. For example, you need to write a program to perform the addition of two numbers. Now break down this problem into smaller chunks… 

Step 1: By reading it you got to know you need 2 numbers and both need to be stored somewhere (in memory). 

Step 2: To add those two numbers you need operand (“+”). 

Step 3: To store the addition result you need some memory. 

Step 4: You need to display the result to the user or you need to use it somewhere else in the program. 

Writing smaller steps will help you to map complex programs into smaller manageable chunks. These smaller chunks can be solved individually and then it can be merged to get the final output or actual solution. 

4. Check Other People’s Code

One of the best things to get better at programming logic is…keep checking the code that others have written. Check code written by other developers on Stackoverflow (the largest community for developers) GitHub, Bitbucket, or other open-source libraries. Check out some great projects on GitHub and learn from them. Check how people are writing the codes and how people are solving some programming problems. When you look at other people’s code and use some method or piece of code from there adjusting your code to get the solution, you eventually need to think over it and use your brain or logic to solve a problem and get the correct solution. Checking other people’s codes also helps you to find out the easier solution or various methods for the same problem.  

5. Make Projects

One of the most important things that a beginner or experienced person should follow to get better at programming logic is to make projects. Working on some real-life projects gives you more exposure and experience to become better at programming. You can choose any kind of project to build such as a web app, android app, or iOS app. Make calculators, eCommerce projects, personal portfolios, or anything that you love to build. You can make any small application or if you are experienced you can build some complex or big project. You learn how the workflow of building a project goes on. 
When you work on a project you need to solve a big problem by breaking it into smaller steps. You need to think over it carefully and solve these smaller chunks to build the complete project. You use the programming syntax and logic to write down some piece of code to solve these smaller chunks, you also move some code here and there to get the correct result, you merge some piece of code, you use the implementation of one function into another one and you face a lot of challenging situations. When you build a project, you go through a lot of difficulties and you debug a lot of problems that help in building the logic in programming. 


1. Don’t skip the question while solving some exercises. Most beginners make a common mistake that they skip some questions and move to the next chapter. Suppose if there are 10 questions and you solved 7 questions (the rest 3 questions you skipped because you think it’s easy), out of that you solved 4 questions on your own and you checked the answers for 3 questions from somewhere else. Now when you move to the 2nd chapter and start solving the exercises from this chapter you face difficulty because your brain is not trained to handle the variety of questions for the 2nd chapter (this is all because you skipped some variety of questions from the previous chapter that helped train your mind to handle the question from 2nd chapter). Do as many questions as you can and train your mind to improve the logic in programming. 

2. When someone is teaching programming, don’t just understand the concept and think that you don’t need to solve the problems on your own if you understood everything that the next person is teaching you. You need to get your hands dirty in code. You can’t get better at building logic in programming until or unless you don’t practice on your own. 

3. Do not check the solution immediately. Check the solution when you spent enough amount of time and are still unable to solve the problem. Try to solve the problems on your own first and have patience. Once you solved it, check the solution written by other developers. 

4. When you make some program and you feel that you need to read some theoretical concept to solve the problem then please go through the theoretical concept first. The theoretical concept builds the basic foundation and helps in solving the problem. 

5. Be consistent. Don’t leave a gap, it’s really important. Practice the programming questions every day. Practicing for three days and leaving it for two days breaks the rhythm and doesn’t help in getting better at programming (especially for beginners).

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!