2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
Basics of Computer Programming For Beginners
Last Updated : 17 Oct, 2024
Be it any programming language in which you want to grow your career, it’s
very important to learn the fundamentals first. Before having a good
command over the basic concepts of programming, you cannot imagine the
growth in that particular career. Hence, this article will talk about all the
basic concepts of programming.
Also, if you’re a beginner aiming to be a software engineer? Students often
seek coding homework assistance from experts when they are beginners or
stuck with their difficult programming tasks. Then you have landed on the
right article. This article is specially designed to give you a glimpse into
programming and take a deep dive into the fundamentals of programming
that most neglect but yet are most important to know.
Table of Content
What is a Computer?
What is a Program (Code)?
Variables and Syntax in Programming
Data Types in Programming
Flow Control Structures in Programming
Why do we need to Learn Any Programming Language?
Programming Methods
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 1/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
What is an Algorithm?
Top Most Popular Programming Languages
Benefits of Learning Programming Languages
What is a Computer?
A computer is an electronic device that will take input from the user, process
it, and give results or respond as per the user. The computer is a
programmable computational device.
The components of a computer are:
1. Input Unit
2. Central Processing Unit(CPU)
3. Output Unit
CPU is known as the brain of the computer system. All the operations within
the system are supervised & controlled by the CPU. It interprets and
coordinates the instructions. The CPU control all internal & external devices,
perform arithmetic and logical operation, controls memory usage, and
control the sequence of operation.
Performing all these operations the CPU has 3 sub-units:
1. Arithmetic and Logical Unit
2. Control Unit
3. Memory Unit
By this point, you will know a bit about computers and their components.
Also read Basics of Computer and its Operations
Now moving on to the next topic.
What is a Program (Code)?
Suppose I give you 10 numbers and tell you to find the average of the given
10 numbers, then how do you find the average? You add all those numbers
and then divide the sum of the numbers by the total numbers given.
Easy task yeah. Now, if 10 sets and each set contain 10 numbers then what
would you do?
For this problem, there are two solutions to solve the problem.
1. You take one set, add each number then divide it by the total numbers. If
you are thinking to solve this problem by this procedure, then it is right to
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 2/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
solve by this but if you are going to be a software engineer then solving
the problem through this approach is not preferred.
2. You can write a program to solve the problem. Just you need to write a
program in which the computer takes input from the user and then it uses
a procedure to find the average.
I have used the word procedure many times, what does it mean?
We define a procedure by giving steps one by one to our computer system
and we call it a program. Like, taking numbers from a user, adding them, and
dividing the sum by the total number is a procedure.
In short, a program is a set of instructions.
Related Article: Programming Language Generations
Variables and Syntax in Programming
Variables are sort of containers for storing data values, and it is also memory
location for the data type. There are certain rules that need to be followed
before declaring them. Variables are generally names allocated to values.
The names are alphanumeric, i.e., they have a-z and 0-9. Also, you can use
special characters while declaring a variable such as $ or _.
While writing a program be it for a small operation (addition, multiplication)
or building an application, you need to require variables. The variable
declared for a value should start with an alphabet and later may include
numbers or special characters.
Syntax is a set of rules that defines the structure of a language. Every
programming language follows a different syntax. A programming language
isn’t understandable without its syntax. Syntax helps the computer to read
and understand the code. It is like giving instructions to the code.
For example,
int a =10;
here a is variable
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 3/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
int is data type
10 is value
Data Types in Programming
Data type is a classification specifying the type of value stored in a variable.
It also indicates what type of operation can be applied to it. Data Types are
generally classified into two types:
1. Primitive – It specifies the size and type of variable. There are eight
primitive types
1. int (4 bytes)
2. short (2 bytes)
3. long (8 bytes)
4. float (4 bytes)
5. double (8 bytes)
6. boolean (1 byte)
7. char (2 bytes)
2. Non-Primitive – Non-primitive types are used to call methods to perform
operations.
1. String (8 bytes)
2. Arrays
3. Class (empty class – 1 byte)
4. Interface
Flow Control Structures in Programming
Flow Control Structures are the ways to specify the flow of controls in a
program. A program is well clear when control structures are used in it. Its
main purpose is to analyze the program. They are 3 types:
1. Sequential – Sequential is the execution of code line by line or one after
the other. For example, cooking an item.
2. Selection – Selection is deciding whether the given condition is true or
false and on the basis of which it produces the final result.
3. Iteration (Loops) – A loop is a structure in which a statement is repeated
again and again until the given condition is satisfied. They are of three
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 4/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
types –
For
While
Do-While
To read more: Flow Control Structures
Why do we need to Learn Any Programming Language?
A computer or any programmable device understands machine language
because the computer works on electricity and electricity works on binary
numbers (0 and 1). We humans only understand natural language. To fulfill
this gap between humans and computers programming language is
introduced.
What happens if either human understands machine language, or a machine
understands natural language?
If that happens then we don’t need to know any programming language to
give instructions to machines and anyone can be a programmer if that
situation happens.
Also Read: Which Programming Language Should I Choose as a
Beginner?
Programming Methods
There are three programming methodologies so far mostly used.
1. Monolithic Programming
2. Modular/ Procedural Programming
3. Object Oriented Programming
Monolithic Programming: It was practiced when programming was just
introduced. In monolithic programming, everything from code, data, and
instruction, is in a single file which makes it difficult to review the code. We
are not reusing the code.
Modular/ Procedural Programming: Procedural programming helps to
divide the work among a team, and we also use function so that it allows for
to reuse
Trending Now ofDSA
the Web
code.
TechData and function
Foundational CoursesareData
used separately.
Science Practice Problem Python Machin
Object Oriented Programming: OOPs are widely used in industries, we take
data and functions together and created them as a class.
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 5/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
In all these programming methods codes remain the same, and the logic
remains the same but one thing changes is how you organize your program
code.
What is an Algorithm?
The algorithm is a step-by-step procedure for solving computational
problems. Programs mean the same, is it?
Every programming language follows a specific syntax that allows us to
write code so that it is easily understandable to the machine. Whereas, in
the algorithm, we write pseudocode. Pseudocode is an informal language
that helps programmers develop algorithms. It is neither in English nor in
code.
Let’s see pseudocode for the algorithm of an average of numbers.
sum == 0, n= total number of elements
for each element num in list
begin
sum = sum + num
average = sum/x
return average
Top Most Popular Programming Languages
Learning a programming language before learning any technology is a must,
hence, it’s very important to have full command of anyone programming
language. Choosing anyone programming language instead of going for
many is better. Try working on basic problems using different programming
languages, and whichever seems easy to you, you can prefer working on
that.
C/C++
Java
JavaScript
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 6/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
Python
Kotlin
Swift
R
Ruby
Scala
TypeScript
If you are planning to learn to program, then you might start with any one of
the above.
Benefits of Learning Programming Languages
As learning a new programming language can be a bit difficult task for the
newcomers but gives a lot of added advantage in excelling the career. Some
of the primary benefits of learning popular programming languages include:
It directly allows you to be more creative in tasks like website designing,
app development, etc.
It can help in developing structured and creative thinking by allowing you
to think about problems from different perspectives.
It also helps you to develop logical thinking skills by teaching you how
to identify patterns and give instructions to computers.
Advances your career with new scope of learning and make you a
potential candidate along with others.
Also, it focuses on the practical learning experience where along with
codes, you may expect the better project results to be on top of
competitions, hackathons, etc.
Conclusion
If you’re a beginner and want to enter the world of programming, this article
covers everything you need to know as a beginner in programming. Start
from the basics and slowly dive deep into the fundamentals and advanced
concepts as well. Get ready to start this programming journey and try to
explore as much as you can.
Related Tutorial:
Learn Programming – How To Code
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 7/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
Comment More info Advertise with us Next Article
Scratch Tutorial
Similar Reads
10+ Free Online Coding for Kids Resources: Websites & Apps
Introducing Free Coding for Kids Resources! Coding has become one of the essential skills to learn in this
tech world, not only for college students or working professionals but also for kids. Learning coding for…
15 min read
How to Start Coding: A Beginner's Guide to Learning Programming
In today's digital age, learning programming has become increasingly important. As technology continues
to advance, the demand for skilled programmers across various industries is on the rise. Whether you wa…
15+ min read
Basics of Computer Programming For Beginners
Be it any programming language in which you want to grow your career, it's very important to learn the
fundamentals first. Before having a good command over the basic concepts of programming, you cannot…
8 min read
Scratch Tutorial
Scratch is a user-friendly programming language designed for kids and beginners. This scratch tutorial will
show you why Scratch is a great choice for young learners who want to start coding by creating simple…
9 min read
Computer Science and Programming For Kids
Welcome to the exciting world of Computer Science & Programming! In this article, designed to introduce
Computer Science for Kids or Coding for Kids, you will get to know what is coding for kids and learn &…
15+ min read
School Programming
Recent Articles The page is designed for beginners in programming language, especially school students.
It has following sections. Introduction to Programming LanguagesLearning a Programming…
7 min read
7 Best Programming Languages For School Students In 2024
Learning programming languages is elementary nowadays. Yes, when it comes to learning a new
language from an early age, school students are taking the mantle. It's no surprise that computer science…
7 min read
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 8/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
Top 30 Scratch Projects in 2024
Scratch is a free programming language developed by MIT where students can create their own interactive
stories, games, and animations. Scratch provides a child-friendly platform where kids can learn coding…
8 min read
Computer Fundamental Tutorial
This Computer Fundamental Tutorial covers everything from basic to advanced concepts, including
computer hardware, software, operating systems, peripherals, etc. Whether you're a beginner or an…
7 min read
GeeksforGeeks School
GeeksforGeeks School - Whether you're looking for NCERT Solutions, RD Sharma Solutions, important
formulas, Previous Year Papers (PYPs), full forms, or other important study material - we've got you…
4 min read
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate
Tower, Sector- 136, Noida, Uttar Pradesh
(201305)
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida, Gautam
Buddh Nagar, Uttar Pradesh, 201305
Advertise with us
Company Languages
About Us Python
Legal Java
Privacy Policy C++
In Media PHP
Contact Us GoLang
Advertise with us SQL
GFG Corporate Solution R Language
Placement Training Program Android Tutorial
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 9/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
GeeksforGeeks Community Tutorials Archive
DSA Data Science & ML
Data Structures Data Science With Python
Algorithms Data Science For Beginner
DSA for Beginners Machine Learning
Basic DSA Problems ML Maths
DSA Roadmap Data Visualisation
Top 100 DSA Interview Problems Pandas
DSA Roadmap by Sandeep Jain NumPy
All Cheat Sheets NLP
Deep Learning
Web Technologies Python Tutorial
HTML Python Programming Examples
CSS Python Projects
JavaScript Python Tkinter
TypeScript Web Scraping
ReactJS OpenCV Tutorial
NextJS Python Interview Question
Bootstrap Django
Web Design
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 10/11
2/25/25, 8:55 AM Basics of Computer Programming For Beginners - GeeksforGeeks
Computer Science DevOps
Operating Systems Git
Computer Network Linux
Database Management System AWS
Software Engineering Docker
Digital Logic Design Kubernetes
Engineering Maths Azure
Software Development GCP
Software Testing DevOps Roadmap
System Design Inteview Preparation
High Level Design Competitive Programming
Low Level Design Top DS or Algo for CP
UML Diagrams Company-Wise Recruitment Process
Interview Guide Company-Wise Preparation
Design Patterns Aptitude Preparation
OOAD Puzzles
System Design Bootcamp
Interview Questions
School Subjects GeeksforGeeks Videos
Mathematics DSA
Physics Python
Chemistry Java
Biology C++
Social Science Web Development
English Grammar Data Science
Commerce CS Subjects
World GK
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
https://www.geeksforgeeks.org/basics-of-computer-programming-for-beginners/ 11/11