0% found this document useful (0 votes)
3 views

Ch-2 Programming Basics

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Ch-2 Programming Basics

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Gajera Global School

CHAPTER-2
PROGRAMMING BASICS
Chaitsi Desai
Computer Educator
Introduction to Programming
■ Computer understand only one language that is machine language.

■ Computer can understand the instruction given in computer language.

■ The set of instructions written in a language which a computer can understand is called a program.

■ Computers solve problem in a step by step procedure to give you accurate result.

■ An algorithm and flowchart help us to create a computer program in step by step manner.

■ Computer program involve three steps

1. Algorithm

2. Making flowchart

3. program
Algorithm
■ An algorithm is a step by step procedure to solve any particular task.

■ Let us understand it by an example what step would you follow to buy a shirt

■ The possible steps are as follows:

1. Take money and go to the shop.

2. Tell the shopkeeper which color and style of shirt you want

3. Choose and finalize the desired shirt

4. Pay money to the shopkeeper

5. Take the balance amount(if any) from the shopkeeper

■ Finally you got the desired result. Your shirt.


Example for Algorithms
■ Write an algorithm to add any two number

Step1: Start

Step2: Take two numbers

Step3: Add the two numbers

Step4: Print the result

Step5: Stop
Example for Algorithms
■ Write an algorithm to find greater number of the two:
Step1: Start
Step2: Take two Numbers A and B
Step3:Compare two numbers; if A>B, then goto Step4 or else goto Step6
Step4:Print A is Greater
Step5: Stop
Step6: Print B is Greater
Step7: Goto Step5
Flowchart
■ A flowchart is a diagrammatic representation of algorithms.

■ The direction of flow in a flowchart is always from top to bottom

■ Herman Goldstine and John Von Neumann develop the flowchart to plan computer
programs

■ In flowchart each operation is represented using some specific symbols .

■ These symbols are connected to each other by arrows to show the operations .
Symbols used for Flowchart
Advantages of flowchart
■ Flow chart help in analyzing the problem in a more effective way
■ It is the better way of communicating the logic of system
■ It act as a guide during the program development phase
■ It helps in finding out errors.

Disadvantages of flowchart
■ Sometimes the flowchart become complex is a program logic is long.
■ If you want to change something in the flowchart you have to redraw it
Program

■ An algorithm is first represented as a flowchart, and the flowchart is then expressed

in programming language to prepare a computer program.

■ Preparing a computer program is the last step in solving a problem.

■ Program is written in the computer language to get the desired result.


Computer language

■ A computer understands the instruction given in machine language.

■ The language use binary digit 0 and 1.

■ It is difficult for a programmer to write their programs directly in terms of these digits.

■ Therefore some other computer languages have been developed in which writing program
have become easier.

■ A computer language also known as programming language.

■ It consists of a set of words, symbols, and a code that is used to write a program.

■ The process of writing a program is called programming.

■ The people who can write programs are called programmers.


Categories Of Computer Languages

■ Computer languages are classified into two major categories:


1. Low level language (LLL)
(I) Machine language (II) Assembly language
2. High level language (HLL)
(I) Procedural language (II) Non-procedural language (III) Natural language
Low level languages:

■ Low level languages are written to run on a particular computer and

cannot be easily used on another computer.

■ Two main categories of low level languages are:

– Machine language

– Assembly language
Machine language

■ Machine language also called First Generation Language.

■ This language directly understood by a computer without any translation.

■ It refers to 0’s and 1’s that a computer can understood as instructions.

■ Due to this reason it is called Low Level Language.

Limitations of machine language


■ Machine language programs run only on the computer for which they have been developed they are
machine dependent

■ Machine language programs are not portable to other computer.


Assembly language
■ Assembly language also called Second Generation language.

■ An assembly language used letters and symbols.

■ A program written in assembly language use short sequence of letters called mnemonic codes Like

ADD for addition, CMP for comparison, LDA for loading and MUL for multiplying

■ Assembly language program is the source program which must be translated into a machine language
before a computer can understand it.

■ An assembler is a program used to translate assembly language into a machine language so that
computer can understand it.
High Level Languages
■ High level language has instructions which are almost similar to English language
used by us.

■ It is very user friendly.

■ HLL is Machine Independent .

■ Interpreter and Compiler are the two program used to translate high level
language into machine level language.
Procedural Language
■ Procedural language is also called the Third Generation language.

■ In this language the programmer writes instructions that tell the computer what to accomplish and how to
do it.

■ This language uses English like words to make it easy for programmers to write the program.

■ For example, ADD for addition or PRINT to print.

■ Third generation language is also use arithmetic operators such as * for multiplication and + for addition.

■ The 3GL is also called the source program, which must be translated into a machine language before
the computer can understand it.

■ C, BASIC, COBOL and FORTRAN are the examples of 3GL.


Non-Procedural Language
■ Non -procedural language is also called the Fourth Generation Language(4GL).

■ In this language the programmer only specifies what the program should accomplish without explaining how.

■ 4GLs are easy to use, that users with very little programming background can develop programs using fourth

generation language.

■ It is also a source program which must be translated to machine language with the help of a compiler or

interpreter.

■ Visual Basic, Java are the examples of 4GL.


Natural Language
■ Natural language sometimes called the Fifth Generation Language.

■ This is the type of query language that allows the user to enter requests that resemble

human speech.

■ Natural languages are opened associated with expert systems and artificial

intelligence.
Language Processor
■ Language processor is a software that convert source program into machine language.
■ Because it understands only machine language.

■ Compiler and Interpreter are example of language processor.

Compiler:
■ A compiler converts the entire HLL program into machine language at once.
■ And display errors for the whole program together.

Interpreter:
■ Interpreter converts one line of program at a time.
■ It displays error of one line at a time and goes to next line only after correction of that error.
THANK YOU!!!

You might also like