How to Code for Beginners
As a beginner, all of us worried to write a perfect code. We are always afraid, how to write a program correctly. At the beginning stage, we made a lot of mistakes what we can overcome easily if we follow some steps while we are writing a code. Now we are going to tell you how to overcome programming phobia easily. Then let’s start.
At first, you must know what is Programming? Do you know
What is Programming?
Programming is that how a human instructs a machine to do a specific task. Now we will be known that how to code a program correctly.
How to write a Program?
Before talking about how to code a program I would like to give you a formula for writing a program. Before solving a programming problem never think how to solve it in a programming language. Think about it as your real life problem. First of all, assume that if it occurred in your real life then what would you do? How would you try to solve it? If you got the solution from real life then it will be more easy to translate into a programming language. Programming is really easy if you know how to code a program efficiently. Sometimes I tell a Bangla quote to others people
As a beginner, so many programmers do some common mistake. One of them is the code is written in an unorganized and un-sequential way. Another one is they can’t utilize programming methods, function, keys etc. with proper concepts. For this reason, they feel nervous to write a code. Let’s try to solve it.
Suppose, someone requested to you for mixed up Coca-Cola and 7up in a glass and display it. What would you like to do that time? I think, at first you have to go a shop for Coca-Cola and 7up. Isn’t it? At next, what would you do? As I know you will take two empty glass to contain the Coca-Cola and 7up, right? Then you will take an empty glass to pour the Coca-Cola and 7up together for mixed up. finally, this is ready for display. It’s too much easy to do, right? Exactly Programming is like that. Now you can ask me how! Wait man wait! I’m here to clear your all confusion. Let’s try to translate this problem into a program using C.
At first, what have you done above? For Coca-Cola you go for a shop, right? Same as we have too many shops named library or header files such as stdio.h, string.h, math.h etc. We use a #include keyword to invoked these header files in the program. If you look at the story you can see that you have been doing the whole process, that means there is someone who will control the whole process, isn’t it? In the programming language, “main” function does this. Now we are going to write the main function. Now what? In the story, we take some glasses for containing the elements, right? Exactly the same way we will declare some variables name to contain the value of what will be given. After this, we will take inputs from the user. For this, we can use scanf, gets etc. Then we will be mixed up the values and store it in an empty variable such as story. For example : Empty_glass = Coca_cola + 7up; Now it’s time to display. For this, we can use printf, puts etc. prebuilt functions. That’s it, see our program is ready. This is so much easy, right? Exactly this is so much easy. If you can solve this way you can easily solve any kind of programming problem. “At first, read the whole problem carefully and think how you will solve it in real life. After solving the problem try to translate it into a programming language”. If you follow these steps I think you can easily and accurately code a program.
General Free Coding Websites & Course Platforms
Be with us, stay happy. Please do your precious comment and give an opportunity to improve us. Happy coding.
November Challenge 2020 SOLUTION CodeChef
- Selecting Edges SOLUTION SELEDGE
- Panic! at the Disco SOLUTION PANIC
- Restore Sequence SOLUTION RESTORE
October Lunchtime 2020 CodeChef SOLUTIONS