SlideShare a Scribd company logo
2
Computer programming is the act of writing computer programs, which are a
sequence of instructions written using a Computer Programming Language to
perform a specified task by the computer.
Introduction to Computer Program
Before getting into computer programming, let us first understand computer
programs and what they do.
A computer program is a sequence of instructions written using a Computer
Programming Language to perform a specified task by the computer.
The two important terms that we have used in the above definition are −
 Sequence of instructions
 Computer Programming Language
To understand these terms, consider a situation when someone asks you about how
to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC?
You will use Human Language to tell the way to go to KFC, something as follows −
First go straight, after half kilometer, take left from the red light and
then drive around one kilometer and you will find KFC at the right.
Here, you have used English Language to give several steps to be taken to reach KFC.
If they are followed in the following sequence, then you will reach KFC −
1. Go straight
2. Drive half kilometer
3. Take left
4. Drive around one kilometer
5. Search for KFC at your right side
Most read
4
Introduction to Computer
Programming
If you understood what a computer program is, then we will say: the act of writing
computer programs is called computer programming.
As we mentioned earlier, there are hundreds of programming languages, which can
be used to write computer programs and following are a few of them −
 Java
 C
 C++
 Python
 PHP
 Perl
 Ruby
Uses of Computer Programs
Today computer programs are being used in almost every field, household,
agriculture, medical, entertainment, defense, communication, etc. Listed below are
a few applications of computer programs −
 MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are
examples of computer programs.
 Computer programs are being used to develop graphics and special effects in
movie making.
 Computer programs are being used to perform Ultrasounds, X-Rays, and other
medical examinations.
 Computer programs are being used in our mobile phones for SMS, Chat, and
voice communication.
Most read
8
In here, we haven’t used any specific programming language but wrote the steps
of a linear search in a simpler form which can be further modified into a proper
program.
Program
A program is a set of instructions for the computer to follow. The machine can’t read
a program directly, because it only understands machine code. But you can write
stuff in a computer language, and then a compiler or interpreter can make it
understandable to the computer.
Program for Linear Search :
// C++ code for linearly search x in arr[]. If x
// is present then return its location, otherwise
// return -1
int search(int arr[], int n, int x)
{
int i;
for (i = 0; i < n; i++)
if (arr[i] == x)
return i;
return -1;
}
Algorithm vs Psuedocode vs Program
1. An algorithm is defined as a well-defined sequence of steps that provides
a solution for a given problem, whereas a pseudocode is one of the methods
that can be used to represent an algorithm.
2. While algorithms are generally written in a natural language or plain
English language, pseudocode is written in a format that is similar to the
structure of a high-level programming language. Program on the other hand
allows us to write a code in a particular programming language.
So, as depicted above you can clearly see how the algorithm is used to generate
the pseudocode which is further expanded by following a particular syntax of a
programming language to create the code of the program.
Most read
Notes on
Concepts of Programming
Instructor:
Arghodeep Paul
Firmware Engineer at BitBible Technologies Pvt. Ltd.
Content License Under: OpenSource
Date: 05 July 2021
Computer programming is the act of writing computer programs, which are a
sequence of instructions written using a Computer Programming Language to
perform a specified task by the computer.
Introduction to Computer Program
Before getting into computer programming, let us first understand computer
programs and what they do.
A computer program is a sequence of instructions written using a Computer
Programming Language to perform a specified task by the computer.
The two important terms that we have used in the above definition are −
 Sequence of instructions
 Computer Programming Language
To understand these terms, consider a situation when someone asks you about how
to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC?
You will use Human Language to tell the way to go to KFC, something as follows −
First go straight, after half kilometer, take left from the red light and
then drive around one kilometer and you will find KFC at the right.
Here, you have used English Language to give several steps to be taken to reach KFC.
If they are followed in the following sequence, then you will reach KFC −
1. Go straight
2. Drive half kilometer
3. Take left
4. Drive around one kilometer
5. Search for KFC at your right side
Now, try to map the situation with a computer program. The above sequence of
instructions is actually a Human Program written in English Language, which
instructs on how to reach KFC from a given starting point. This same sequence could
have been given in Spanish, Hindi, Arabic, or any other human language, provided
the person seeking direction knows any of these languages.
Now, let's go back and try to understand a computer program, which is a sequence
of instructions written in a Computer Language to perform a specified task by the
computer. Following is a simple program written in Python programming Language
−
print "Hello, World!"
The above computer program instructs the computer to print "Hello, World!" on
the computer screen.
A computer program is also called a computer software, which can range
from two lines to millions of lines of instructions.
Computer program instructions are also called program source code
and computer programming is also called program coding.
A computer without a computer program is just a dump box; it is programs
that make computers active.
As we have developed so many languages to communicate among ourselves,
computer scientists have developed several computer-programming languages to
provide instructions to the computer (i.e., to write computer programs). We will see
several computer programming languages in the subsequent chapters.
Introduction to Computer
Programming
If you understood what a computer program is, then we will say: the act of writing
computer programs is called computer programming.
As we mentioned earlier, there are hundreds of programming languages, which can
be used to write computer programs and following are a few of them −
 Java
 C
 C++
 Python
 PHP
 Perl
 Ruby
Uses of Computer Programs
Today computer programs are being used in almost every field, household,
agriculture, medical, entertainment, defense, communication, etc. Listed below are
a few applications of computer programs −
 MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are
examples of computer programs.
 Computer programs are being used to develop graphics and special effects in
movie making.
 Computer programs are being used to perform Ultrasounds, X-Rays, and other
medical examinations.
 Computer programs are being used in our mobile phones for SMS, Chat, and
voice communication.
Computer Programmer
Someone who can write computer programs or in other words, someone who can
do computer programming is called a Computer Programmer.
Based on computer programming language expertise, we can name a computer
programmers as follows −
 C Programmer
 C++ Programmer
 Java Programmer
 Python Programmer
 PHP Programmer
 Perl Programmer
 Ruby Programmer
Algorithm, Pseudocode and Program
Algorithm : Systematic logical approach which is a well-defined, step-by-step
procedure that allows a computer to solve a problem.
Pseudocode : It is a simpler version of a programming code in plain English which
uses short phrases to write code for a program before it is implemented in a specific
programming language.
Program : It is exact code written for problem following all the rules of the
programming language.
Algorithm
An algorithm is used to provide a solution to a particular problem in form of well-
defined steps. Whenever you use a computer to solve a particular problem, the
steps which lead to the solution should be properly communicated to the computer.
While executing an algorithm on a computer, several operations such as additions
and subtractions are combined to perform more complex mathematical operations.
Algorithms can be expressed using natural language, flowcharts, etc.
Let’s take a look at an example for a better understanding. As a programmer, we are
all aware of the Linear Search program.
Algorithm of linear search :
1. Start from the leftmost element of arr[] and
one by one compare x with each element of arr[].
2. If x matches with an element, return the index.
3. If x doesn’t match with any of elements, return -1.
Here, we can see how the steps of a linear search program are explained in a simple,
English language.
Pseudocode
It is one of the methods which can be used to represent an algorithm for a program.
It does not have a specific syntax like any of the programming languages and thus
cannot be executed on a computer. There are several formats which are used to
write pseudo-codes and most of them take down the structures from languages such
as C, Lisp, FORTRAN, etc.
Many time algorithms are presented using pseudocode since they can be read and
understood by programmers who are familiar with different programming languages.
Pseudocode allows you to include several control structures such as While, If-then-
else, Repeat-until, for and case, which is present in many high-level languages.
Note: Pseudocode is not an actual programming language.
Peudocode for Linear Search :
FUNCTION linearSearch(list, searchTerm):
FOR index FROM 0 -> length(list):
IF list[index] == searchTerm THEN
RETURN index
ENDIF
ENDLOOP
RETURN -1
END FUNCTION
In here, we haven’t used any specific programming language but wrote the steps
of a linear search in a simpler form which can be further modified into a proper
program.
Program
A program is a set of instructions for the computer to follow. The machine can’t read
a program directly, because it only understands machine code. But you can write
stuff in a computer language, and then a compiler or interpreter can make it
understandable to the computer.
Program for Linear Search :
// C++ code for linearly search x in arr[]. If x
// is present then return its location, otherwise
// return -1
int search(int arr[], int n, int x)
{
int i;
for (i = 0; i < n; i++)
if (arr[i] == x)
return i;
return -1;
}
Algorithm vs Psuedocode vs Program
1. An algorithm is defined as a well-defined sequence of steps that provides
a solution for a given problem, whereas a pseudocode is one of the methods
that can be used to represent an algorithm.
2. While algorithms are generally written in a natural language or plain
English language, pseudocode is written in a format that is similar to the
structure of a high-level programming language. Program on the other hand
allows us to write a code in a particular programming language.
So, as depicted above you can clearly see how the algorithm is used to generate
the pseudocode which is further expanded by following a particular syntax of a
programming language to create the code of the program.
Elements of PLs
We assume you are well aware of English Language, which is a well-known Human
Interface Language. English has a predefined grammar, which needs to be followed
to write English statements in a correct way. Likewise, most of the Human Interface
Languages (Hindi, English, Spanish, French, etc.) are made of several elements like
verbs, nouns, adjectives, adverbs, propositions, and conjunctions, etc.
Similar to Human Interface Languages, Computer Programming Languages are also
made of several elements. We will take you through the basics of those elements
and make you comfortable to use them in various programming languages. These
basic elements include −
 Programming Environment
 Basic Syntax
 Data Types
 Variables
 Keywords
 Basic Operators
 Decision Making
 Loops
 Numbers
 Characters
 Arrays
 Strings
 Functions
 File I/O
We will explain all these elements in subsequent chapters with examples using
different programming languages. First, we will try to understand the meaning of all
these terms in general and then, we will see how these terms can be used in
different programming languages.
This tutorial has been designed to give you an idea about the following most
popular programming languages −
 C Programming
 Java Programming
 Python Programming
A major part of the tutorial has been explained by taking C as programming
language and then we have shown how similar concepts work in Java and Python.
So after completion of this tutorial, you will be quite familiar with these popular
programming languages.
Programming Environment
Environment Setup is not an element of any Programming Language, it is the first
step to be followed before setting on to write a program.
When we say Environment Setup, it simply implies a base on top of which we can
do our programming. Thus, we need to have the required software setup, i.e.,
installation on our PC which will be used to write computer programs, compile, and
execute them.
A programming environments is the collection of tools used in the development of
software.
This collection may consist:-
 A file system,
 A text editor,
 A linker,
 A compiler,
 Integrated tools
These tools may be access through a uniform interface (GUI).
Some of the examples of programming environments are-
1) Microsoft Visual Studio .NET, which is a large collection of software development
tools, used through a windows interface.
It is used to develop software in following languages-
 C#,
 Visual Basic .NET,
 JScript(MS JavaScript version),
 J# (MS Java version),
 managed C++.
2) NetBeans
3) Turbo C, C++
4) Dreamweaver
5) Arduino, etc.

More Related Content

What's hot (20)

Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Introduction to programming languages
Introduction to programming languagesIntroduction to programming languages
Introduction to programming languages
Sayed Mahmoud AbdEl Rahman
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
Prof. Dr. K. Adisesha
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
 
Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
Gaditek
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
educationfront
 
C++ ppt
C++ pptC++ ppt
C++ ppt
parpan34
 
1. Introduction to Computer (CSI-321)
1. Introduction to Computer (CSI-321)1. Introduction to Computer (CSI-321)
1. Introduction to Computer (CSI-321)
ghayour abbas
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Basic+machine+organization
Basic+machine+organizationBasic+machine+organization
Basic+machine+organization
Bilal Maqbool ツ
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
fazli khaliq
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
Syed Zaid Irshad
 
Computer languages
Computer languagesComputer languages
Computer languages
Buxoo Abdullah
 
Algorithm
AlgorithmAlgorithm
Algorithm
IHTISHAM UL HAQ
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
AqsaHayat3
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
imtiazalijoono
 
Computer languages
Computer languagesComputer languages
Computer languages
AqdasNoor
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
 
Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
Gaditek
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
educationfront
 
1. Introduction to Computer (CSI-321)
1. Introduction to Computer (CSI-321)1. Introduction to Computer (CSI-321)
1. Introduction to Computer (CSI-321)
ghayour abbas
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
fazli khaliq
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
AqsaHayat3
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 
Computer languages
Computer languagesComputer languages
Computer languages
AqdasNoor
 

Similar to notes on Programming fundamentals (20)

Computer programming
Computer programmingComputer programming
Computer programming
Mohamed Asarudeen
 
Introduction to object oriented programming.pptx
Introduction to object oriented programming.pptxIntroduction to object oriented programming.pptx
Introduction to object oriented programming.pptx
BINJAD1
 
Computer program, computer languages, computer software
Computer program, computer languages, computer softwareComputer program, computer languages, computer software
Computer program, computer languages, computer software
Sweta Kumari Barnwal
 
inbound8ghjjvcgggg229348990909594357.pptx
inbound8ghjjvcgggg229348990909594357.pptxinbound8ghjjvcgggg229348990909594357.pptx
inbound8ghjjvcgggg229348990909594357.pptx
RosemelynDescalsoLag
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
Kak Yong
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
PmarkNorcio
 
grade 10 2023.pptx
grade 10 2023.pptxgrade 10 2023.pptx
grade 10 2023.pptx
RaymartHerera
 
Introduction to Programming kkkkkkkkkkkkk
Introduction to Programming kkkkkkkkkkkkkIntroduction to Programming kkkkkkkkkkkkk
Introduction to Programming kkkkkkkkkkkkk
kimtrm34
 
Chapter 1- C++ programming languages +.ppt
Chapter 1- C++ programming languages +.pptChapter 1- C++ programming languages +.ppt
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
Cw1
Cw1Cw1
Cw1
ahmadk1997
 
Pf lec 01 intro
Pf lec 01 introPf lec 01 intro
Pf lec 01 intro
RajaKayani
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
Seble Nigussie
 
Programming
ProgrammingProgramming
Programming
Alawi Alradhi
 
Lecture 1-3.ppt
Lecture 1-3.pptLecture 1-3.ppt
Lecture 1-3.ppt
HafeezullahJamro
 
Programming str_Language of Logic/c.pptx
Programming str_Language of Logic/c.pptxProgramming str_Language of Logic/c.pptx
Programming str_Language of Logic/c.pptx
MsKGowriDhilipkumar
 
Programming _Language of Logic_ PPT.pptx
Programming _Language of Logic_ PPT.pptxProgramming _Language of Logic_ PPT.pptx
Programming _Language of Logic_ PPT.pptx
MsKGowriDhilipkumar
 
computer programming computer programmin
computer programming computer programmincomputer programming computer programmin
computer programming computer programmin
Jifarnecho
 
Language translators Of Programming in Computer science
Language translators Of Programming in Computer scienceLanguage translators Of Programming in Computer science
Language translators Of Programming in Computer science
RaianaTabitha
 
Computer programing 111 lecture 1
Computer programing 111 lecture 1 Computer programing 111 lecture 1
Computer programing 111 lecture 1
ITNet
 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
Mohd Harris Ahmad Jaal
 
Introduction to object oriented programming.pptx
Introduction to object oriented programming.pptxIntroduction to object oriented programming.pptx
Introduction to object oriented programming.pptx
BINJAD1
 
Computer program, computer languages, computer software
Computer program, computer languages, computer softwareComputer program, computer languages, computer software
Computer program, computer languages, computer software
Sweta Kumari Barnwal
 
inbound8ghjjvcgggg229348990909594357.pptx
inbound8ghjjvcgggg229348990909594357.pptxinbound8ghjjvcgggg229348990909594357.pptx
inbound8ghjjvcgggg229348990909594357.pptx
RosemelynDescalsoLag
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
Kak Yong
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
PmarkNorcio
 
Introduction to Programming kkkkkkkkkkkkk
Introduction to Programming kkkkkkkkkkkkkIntroduction to Programming kkkkkkkkkkkkk
Introduction to Programming kkkkkkkkkkkkk
kimtrm34
 
Chapter 1- C++ programming languages +.ppt
Chapter 1- C++ programming languages +.pptChapter 1- C++ programming languages +.ppt
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
Pf lec 01 intro
Pf lec 01 introPf lec 01 intro
Pf lec 01 intro
RajaKayani
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
Seble Nigussie
 
Programming str_Language of Logic/c.pptx
Programming str_Language of Logic/c.pptxProgramming str_Language of Logic/c.pptx
Programming str_Language of Logic/c.pptx
MsKGowriDhilipkumar
 
Programming _Language of Logic_ PPT.pptx
Programming _Language of Logic_ PPT.pptxProgramming _Language of Logic_ PPT.pptx
Programming _Language of Logic_ PPT.pptx
MsKGowriDhilipkumar
 
computer programming computer programmin
computer programming computer programmincomputer programming computer programmin
computer programming computer programmin
Jifarnecho
 
Language translators Of Programming in Computer science
Language translators Of Programming in Computer scienceLanguage translators Of Programming in Computer science
Language translators Of Programming in Computer science
RaianaTabitha
 
Computer programing 111 lecture 1
Computer programing 111 lecture 1 Computer programing 111 lecture 1
Computer programing 111 lecture 1
ITNet
 
Ad

More from ArghodeepPaul (12)

Microprocessor questions converted
Microprocessor questions convertedMicroprocessor questions converted
Microprocessor questions converted
ArghodeepPaul
 
Windows script host
Windows script hostWindows script host
Windows script host
ArghodeepPaul
 
Windows batch scripting
Windows batch scriptingWindows batch scripting
Windows batch scripting
ArghodeepPaul
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
ArghodeepPaul
 
C operators
C operatorsC operators
C operators
ArghodeepPaul
 
C taking user input
C taking user inputC taking user input
C taking user input
ArghodeepPaul
 
C storage classes
C storage classesC storage classes
C storage classes
ArghodeepPaul
 
C datatypes
C datatypesC datatypes
C datatypes
ArghodeepPaul
 
C variables and constants
C variables and constantsC variables and constants
C variables and constants
ArghodeepPaul
 
C program structure
C program structureC program structure
C program structure
ArghodeepPaul
 
Computer programming tools and building process
Computer programming tools and building processComputer programming tools and building process
Computer programming tools and building process
ArghodeepPaul
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
ArghodeepPaul
 
Microprocessor questions converted
Microprocessor questions convertedMicroprocessor questions converted
Microprocessor questions converted
ArghodeepPaul
 
Windows batch scripting
Windows batch scriptingWindows batch scripting
Windows batch scripting
ArghodeepPaul
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
ArghodeepPaul
 
C variables and constants
C variables and constantsC variables and constants
C variables and constants
ArghodeepPaul
 
Computer programming tools and building process
Computer programming tools and building processComputer programming tools and building process
Computer programming tools and building process
ArghodeepPaul
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
ArghodeepPaul
 
Ad

Recently uploaded (20)

362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptxDevelopment of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank
Guru Nanak Technical Institutions
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cellsGreat power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptxWeek 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptxDevelopment of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cellsGreat power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptxWeek 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
Week 6- PC HARDWARE AND MAINTENANCE-THEORY.pptx
dayananda54
 

notes on Programming fundamentals

  • 1. Notes on Concepts of Programming Instructor: Arghodeep Paul Firmware Engineer at BitBible Technologies Pvt. Ltd. Content License Under: OpenSource Date: 05 July 2021
  • 2. Computer programming is the act of writing computer programs, which are a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. Introduction to Computer Program Before getting into computer programming, let us first understand computer programs and what they do. A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. The two important terms that we have used in the above definition are −  Sequence of instructions  Computer Programming Language To understand these terms, consider a situation when someone asks you about how to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC? You will use Human Language to tell the way to go to KFC, something as follows − First go straight, after half kilometer, take left from the red light and then drive around one kilometer and you will find KFC at the right. Here, you have used English Language to give several steps to be taken to reach KFC. If they are followed in the following sequence, then you will reach KFC − 1. Go straight 2. Drive half kilometer 3. Take left 4. Drive around one kilometer 5. Search for KFC at your right side
  • 3. Now, try to map the situation with a computer program. The above sequence of instructions is actually a Human Program written in English Language, which instructs on how to reach KFC from a given starting point. This same sequence could have been given in Spanish, Hindi, Arabic, or any other human language, provided the person seeking direction knows any of these languages. Now, let's go back and try to understand a computer program, which is a sequence of instructions written in a Computer Language to perform a specified task by the computer. Following is a simple program written in Python programming Language − print "Hello, World!" The above computer program instructs the computer to print "Hello, World!" on the computer screen. A computer program is also called a computer software, which can range from two lines to millions of lines of instructions. Computer program instructions are also called program source code and computer programming is also called program coding. A computer without a computer program is just a dump box; it is programs that make computers active. As we have developed so many languages to communicate among ourselves, computer scientists have developed several computer-programming languages to provide instructions to the computer (i.e., to write computer programs). We will see several computer programming languages in the subsequent chapters.
  • 4. Introduction to Computer Programming If you understood what a computer program is, then we will say: the act of writing computer programs is called computer programming. As we mentioned earlier, there are hundreds of programming languages, which can be used to write computer programs and following are a few of them −  Java  C  C++  Python  PHP  Perl  Ruby Uses of Computer Programs Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Listed below are a few applications of computer programs −  MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are examples of computer programs.  Computer programs are being used to develop graphics and special effects in movie making.  Computer programs are being used to perform Ultrasounds, X-Rays, and other medical examinations.  Computer programs are being used in our mobile phones for SMS, Chat, and voice communication.
  • 5. Computer Programmer Someone who can write computer programs or in other words, someone who can do computer programming is called a Computer Programmer. Based on computer programming language expertise, we can name a computer programmers as follows −  C Programmer  C++ Programmer  Java Programmer  Python Programmer  PHP Programmer  Perl Programmer  Ruby Programmer Algorithm, Pseudocode and Program Algorithm : Systematic logical approach which is a well-defined, step-by-step procedure that allows a computer to solve a problem. Pseudocode : It is a simpler version of a programming code in plain English which uses short phrases to write code for a program before it is implemented in a specific programming language. Program : It is exact code written for problem following all the rules of the programming language.
  • 6. Algorithm An algorithm is used to provide a solution to a particular problem in form of well- defined steps. Whenever you use a computer to solve a particular problem, the steps which lead to the solution should be properly communicated to the computer. While executing an algorithm on a computer, several operations such as additions and subtractions are combined to perform more complex mathematical operations. Algorithms can be expressed using natural language, flowcharts, etc. Let’s take a look at an example for a better understanding. As a programmer, we are all aware of the Linear Search program. Algorithm of linear search : 1. Start from the leftmost element of arr[] and one by one compare x with each element of arr[]. 2. If x matches with an element, return the index. 3. If x doesn’t match with any of elements, return -1. Here, we can see how the steps of a linear search program are explained in a simple, English language.
  • 7. Pseudocode It is one of the methods which can be used to represent an algorithm for a program. It does not have a specific syntax like any of the programming languages and thus cannot be executed on a computer. There are several formats which are used to write pseudo-codes and most of them take down the structures from languages such as C, Lisp, FORTRAN, etc. Many time algorithms are presented using pseudocode since they can be read and understood by programmers who are familiar with different programming languages. Pseudocode allows you to include several control structures such as While, If-then- else, Repeat-until, for and case, which is present in many high-level languages. Note: Pseudocode is not an actual programming language. Peudocode for Linear Search : FUNCTION linearSearch(list, searchTerm): FOR index FROM 0 -> length(list): IF list[index] == searchTerm THEN RETURN index ENDIF ENDLOOP RETURN -1 END FUNCTION
  • 8. In here, we haven’t used any specific programming language but wrote the steps of a linear search in a simpler form which can be further modified into a proper program. Program A program is a set of instructions for the computer to follow. The machine can’t read a program directly, because it only understands machine code. But you can write stuff in a computer language, and then a compiler or interpreter can make it understandable to the computer. Program for Linear Search : // C++ code for linearly search x in arr[]. If x // is present then return its location, otherwise // return -1 int search(int arr[], int n, int x) { int i; for (i = 0; i < n; i++) if (arr[i] == x) return i; return -1; } Algorithm vs Psuedocode vs Program 1. An algorithm is defined as a well-defined sequence of steps that provides a solution for a given problem, whereas a pseudocode is one of the methods that can be used to represent an algorithm. 2. While algorithms are generally written in a natural language or plain English language, pseudocode is written in a format that is similar to the structure of a high-level programming language. Program on the other hand allows us to write a code in a particular programming language. So, as depicted above you can clearly see how the algorithm is used to generate the pseudocode which is further expanded by following a particular syntax of a programming language to create the code of the program.
  • 9. Elements of PLs We assume you are well aware of English Language, which is a well-known Human Interface Language. English has a predefined grammar, which needs to be followed to write English statements in a correct way. Likewise, most of the Human Interface Languages (Hindi, English, Spanish, French, etc.) are made of several elements like verbs, nouns, adjectives, adverbs, propositions, and conjunctions, etc. Similar to Human Interface Languages, Computer Programming Languages are also made of several elements. We will take you through the basics of those elements and make you comfortable to use them in various programming languages. These basic elements include −  Programming Environment  Basic Syntax  Data Types  Variables  Keywords  Basic Operators  Decision Making  Loops  Numbers  Characters  Arrays  Strings  Functions  File I/O We will explain all these elements in subsequent chapters with examples using different programming languages. First, we will try to understand the meaning of all these terms in general and then, we will see how these terms can be used in different programming languages. This tutorial has been designed to give you an idea about the following most popular programming languages −
  • 10.  C Programming  Java Programming  Python Programming A major part of the tutorial has been explained by taking C as programming language and then we have shown how similar concepts work in Java and Python. So after completion of this tutorial, you will be quite familiar with these popular programming languages. Programming Environment Environment Setup is not an element of any Programming Language, it is the first step to be followed before setting on to write a program. When we say Environment Setup, it simply implies a base on top of which we can do our programming. Thus, we need to have the required software setup, i.e., installation on our PC which will be used to write computer programs, compile, and execute them. A programming environments is the collection of tools used in the development of software. This collection may consist:-  A file system,  A text editor,  A linker,  A compiler,  Integrated tools These tools may be access through a uniform interface (GUI). Some of the examples of programming environments are- 1) Microsoft Visual Studio .NET, which is a large collection of software development tools, used through a windows interface. It is used to develop software in following languages-  C#,  Visual Basic .NET,  JScript(MS JavaScript version),  J# (MS Java version),
  • 11.  managed C++. 2) NetBeans 3) Turbo C, C++ 4) Dreamweaver 5) Arduino, etc.