How to learn coding to write your first program code

Home » Programming » C Programming » How to learn coding to write your first program code

Coding is a very important aspect of the modern lifestyle because everything is going digitalized. So it is very important to know how to learn coding with a machine such as a computer. It can make your day to day digital task very easy to do. It will also help you to resolve a few minor software errors if you know how to code. So in this article, you will know how to get started with computer coding.

Prerequisite for writing and running a program code

In order to write and run a program code, you need certain things. I have listed below.


It can be a desktop computer or laptop or tablet, or even a mobile phone with basic computing power. But if you are using some heavy IDE(Integrated Development Environment)  then it might require some additional computing power. In such a case, you don’t need to have the other software requirement listed below. As it comes along with the IDE. A few examples of the IDE are Visual Studio Code(VS Code), IntelliJ IDEA, PyCharm, Eclipse, NetBeans, Jupyter Notebook, etc…

Text Editor

You can use any text editor to write your program code. A basic text editor with few basic functionalities can work such as notepad in Windows operating system and gedit in Linux operating system. This both text editors are with the graphical user interface. In a Linux system, you can use a console-based editor such as nano, vim, etc…


After you have written the code in any language of your preference it is time to compile and run it. If the programming language that you have used needs to be compiled then you need a compiler. For example, a programming language such as C, C++, and Java needs a compiler. Since the program written in it needs to get compiled so that the machine/computer can understand the program code. A compiler will basically convert the high-level programming language to a machine code which the machine can execute. A few compiler’s names are as follows.

  • javac for java language
  • gcc for C language
  • g++ for C++ language

Otherwise, you can use an interpreter to run your program code without compiling. For example, the python code does not require a compiler. You can directly run the code after you finish writing your code. The interpreter takes care of the rest thing behind the scene.


You need a terminal in order to run a program code. This will come inbuilt with the operating system. For example, in a Windows operating system, CMD(command-line interface) is there and in the Linux operating system, it has its own terminal( Bash for Ubuntu).

Learn hello world coding in C

/* hello.c file name */
/* Hello World Code in C */
int main(){
    printf("Hello World\n");
    return 0;

Now in order to compile and run the program, you can use the following command.
Compile: gcc -o hello hello.c
Run: ./hello

Hello World! Code in C++

//hello.cpp file name
using namespace std;
int main(){
    cout << "Hello World!" << endl;
    return 0;

You can compile and run the above code using the following command in the terminal.
Compile: g++ -o hello hello.cpp
Run: ./hello

Write your first code in Java

// file name
//Hello World Code in Java
public class Hello{
    public static void main(String[] arg)
        System.out.println("Hello World");

Now you can compile and run the above program using the following command.
Compile: javac
Run: java Hello

Remember you should name the java file as same as that of the name of the class which contains the main function. In the above code, the class name is ‘Hello’. Therefore is the name of the java file. Once you compile the code it will produce the bytecode with the same file name with the extension “.class”. You use the bytecode file name without extension to execute the program code. It will be executed by Java Virtual Machine(JVM).

Learn hello world program code in python file name
#Hello World Code in Python
print("Hello World")

Now in order to run the code, you can use the following command.
Run: python


In a nutshell, you know what things are required in order to get started to learn coding in any programming language. Such as device, editor, compiler/interpreter, and terminal. Then to write a program in a specific language you should know its syntax and usage. Now to know details about how to learn about the specific programming languages you can do online learning and get certified. Few popular websites are Coursera, Tutorials Point, Udemy, edX, MIT OpenCourseWare, etc… You can avail of free courses as well as paid courses from the above-listed websites. You can also follow this website to learn about programming.