Web & App Development

# How to improve computer programming logic

Out of many questions asked the most common questions I see is “How can I improve my programming logic”. Remember the quote “Practice makes the man perfect”. This applies to you all who are in need of improving their programming skills. You can improve computer programming logic in a better way, here are some tips.

Programming is mainly associated with the field of Computer Science and also is a hobby for students of other streams as well, but writing good and optimized code is mainly an art. Here are some of my most useful tips that will help you in improving your logical ability

## Tips to improve computer programming logic

### Learn ‘C’ language

We all know why ‘C’ is the most powerful programming language, but I am not recommending learning ‘C’ to you because of its power in programming. You might be an expert .NET, Java or PHP developer, but I would recommend that learning ‘C’ will be helpful to you, as ‘C’ offers you a structured style of programming. You have one file with the main() method and the execution begins from there and the execution flow proceeds as you have directed it to.

Also read: Why Python Became a Globally Well-Known Programming Language
The main advantage in ‘C’ is that it allows you to play around with memory directly. This I believe is very important if you need to understand how data is passed from one memory block to another. If it doesn’t make any sense to you read more of the tips below.

### Make programs that test your mind skills

Ever built a program that will allow the user to type his/her name and allow to bounce off that name on the screen from one corner to another like a ball?

Ever thought of creating a library for a Menu Bar system?

All these are examples of programs that you can develop to improve your mind and programming skills.

In my college, my faculties ask us to write the logic in ‘C’ or ‘C++’ related to the ‘*’, and ‘numbers’ ladder or patterns.

Like a triangle shaped “*” or numbers shown below.

`*       12345     *****     12345**      1234       ****     12345***     123         ***     12345****    12           **     12345*****   1             *     12345`

All these kind of algorithms can be written in any language, But they are very useful in dealing with your mind skills. The above-mentioned algorithm can be solved using only ‘for’ loop in ‘C’ and ‘C++’. Try to develop as many programs as possible in ‘C’, this will help you improve your programming logic. I recommend you to use an App in play store for android named as “C++ pattern program free” try searching it in google and play store.

#### Following are Some programs that will help you to built logic:

1. Write a program(WAP) to find the max, min, average and total of numbers entered by the user
2. WAP to accept an array of numbers and sort the same using Bubble Sort Algorithm.
3. WAP to accept a string from the user and find the number of vowels and the vowels that got repeated the most.
4. WAP to accept a number from the user and test if it is a Fibonacci number or not.
5. WAP to accept a string from the user and print all its permutations and combinations.

### Program every day and practice more of it

The main objective of all the exercise above is to get your brain think faster and improve your ability. Below there are more brain-related exercises that you should do every day if possible.
Use the internet or college library to locate code written by another developer. Try to understand and understand it completely. Once you have understood, check to see if you could improve that logic. Locate codes and try to understand why it was written that way.

Solve logic puzzles Check your daily newspaper. One section of your newspaper will be filled with a series of logic puzzles and riddles. Try solving them. Don’t get disheartened if you can’t solve them or take a long time to solve them. Things will be slow, but you will make progress. Your brain will be trained to think differently with every puzzle that you try to solve.
I would prescribe solving Sudoku puzzles. This will help you improve your logic, concentration, and skills of grouping and organizing.

The more you practice the more confidence you built. Once you start feeling confident about yourself and your logic capabilities, you should immediately start helping other people.

### Subscribe to a forum and start helping people there.

The benefit of helping people on forums is that you get to learn new problems that people face.

This immensely adds to your knowledge. And I believe that you will do all the above mentioned in a proper manner because this will only help you in a better way, no one can make you learn to program unless you try to answer.

If you are good in basics of any language, please don’t join any coaching classes as they will just ruin your abilities, but if need a guidance Google is filled with an enormous post like this.

Hope you like these posts. Thank you for reading.

• Himanshu Singh says:

here is your answer in simple way, make it as you ish its just a starting

include
include
using namespace std;

int factorial(int n)
{

int accum = 1;
while(n > 0)
{
accum *= n;
n–;
}
return accum;
}

int main(){
string a;
int b;
cout<<"Enter the word without space: ";
cin>>a;
b=a.length();
cout<<endl<<factorial(b)<<" possible combinations.";

return 0;
}

• Lokesh Goyal says:

Hello Sir, Please give me solution in any programming language :
You have to enter a string and print all the possible combination of that.
Like if you enter "abc"
then result is : abc, acb, bca, bac, cab, cba