UNIT1 - 4types of Programming Languages
UNIT1 - 4types of Programming Languages
D.Brindha,
Assistant Professor/CSE,
KITS.
1
Computer-programming language
🞂 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).
🞂 Java
🞂 C
🞂 C++
🞂 Python
🞂 PHP
🞂 Ruby
🞂 Perl
2
Uses of Computer Programs
🞂 Today computer programs are being used in almost every field, household,
agriculture, medical, entertainment, defense, communication, etc.
🞂 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.
3
4
Which language computer can
understand?
🞂 Computers only understand machine code
5
English to Binary
High-Level Language: D = A * B + 10
13
Basic elements of Computer
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, Tamil, English, Spanish, French, etc.) are
made of several elements like verbs, nouns, adjectives, adverbs,
propositions, and conjunctions, etc.
14
Structured Programming
C programming language is called a structured programming
language because to solve a large problem, it divides the
problem into smaller structural blocks each of which handles a
particular responsibility.
These structural blocks are
• Subroutines/procedures - functions
• Decision making blocks like if-else-elseif, switch-cases,
• Repetitive blocks like For-loop, While-loop, Do-while loop etc
16
Subroutines/procedures
• A procedure is a subroutine that performs a specific
task.
• When the task is complete, the subroutine ends and
the main program continues from where it left off.
A Decision Statement
Syntax
if(condition)
false
condition
action
• Syntax
if (condition) true false
Action_A condition
else
Action_B
execute Action_A
else
execute Action_B.
A Repetitive Statement (LOOP)
• Syntax
while (condition)
action
• How it works:
– if condition is true then execute condition
false
action
– repeat this process until
condition evaluates to false
true
• action is either a single
statement or a group of action
statements within braces.
Repetitive Statement
• Syntax
do action
while (condition)
• How it works: action
– execute action
– if condition is true then execute
action again
– repeat this process until
condition evaluates to false.
true
• action is either a single statement or condition
a group of statements within braces.
false
Advantages of Structured
Programming
1. It is user friendly and easy to understand.
2. Similar to English vocabulary of words and symbols.
3. They require less time to write.
4. They are easier to maintain.
5. These are mainly problem oriented rather than machine based.
6. Program written in a higher level language can be translated
into many machine languages and therefore can run on any
computer for which there exists an appropriate translator.
7. It is independent of machine on which it is used i.e. programs
developed in high level languages can be run on any computer.
22
Choosing a Programming Language
Before decide on what language to use,
consider the following:
• server platform
• the server software to run
• budget
• previous experience in programming
• the database chosen for backend
23