TOPIC 1.0 INTRODUCTORY TO PROGRAMMING - Farah
TOPIC 1.0 INTRODUCTORY TO PROGRAMMING - Farah
INTRODUCTORY TO
PROGRAMMING
HISTORY TYPES
STRUCTURE
Learning Outcomes
Function name
Comment
Function body
End block
Comment statement
Begin of program
Learning Outcomes
MACHINE ASSEMBLY
LANGUAGE LANGUAGE
HIGH LEVEL
LANGUAGE
MACHINE LANGUAGE
Machine language as the lowest-level programming
language is the only language understood by
computer. While easily understood by computer,
machine language is the almost impossible for
humans to use because they consist entirely of
numbers (comprised of only two characters: 0 and 1).
MACHINE LANGUAGE
Different for each type of CPU, it is the native binary
language of the computer and is difficult to be read
and understood by humans. Programs written in high-
level languages are translated into assembly language
or machine language by a compiler. Assembly
language programs are translated into machine
language by a program called an assembler.
MACHINE LANGUAGE
Every CPU has its own unique machine language.
Programs must be rewritten or recompiled, therefore, to
run on different types of computers. For example, a
program written in Apple PC cannot be run in IBM PC.
ASSEMBLY LANGUAGE
An assembly language is a low-level programming
language for a computer. Assembly languages have
the same structure and set of commands as machine
languages, but they enable a programmer to use
names instead of numbers.
ASSEMBLY LANGUAGE
Each type of CPU has its own machine language and
assembly language, so an assembly language program
written for one type of CPU won't run on another.
algorithm flowchart
pseudocode
Learning Outcomes
Page 2
Example
flowchart
START
END
START
Display output
gross_pay.
END
START
Variable contents:
Display output
hour: ? gross_pay.
rate: ?
END
gross_pay: ?
Stepping Through the START
Variable contents:
Display output
hour: 8 gross_pay.
rate: ?
END
gross_pay: ?
Stepping Through the START
Variable contents:
Display output
hour: 8 gross_pay.
rate: ?
END
gross_pay: ?
Stepping Through the START
Variable contents:
Display output
hour: 8 gross_pay.
rate: 20
END
gross_pay: ?
Stepping Through the START
Variable contents:
Display output
hour: 8 gross_pay.
rate: 20
END
gross_pay: 160
Stepping Through the START
Variable contents:
Display output
hour: 8 gross_pay.
rate: 20
END
gross_pay: 160
Pseudocode TO FLOWCHART
Program: Determine the price of discount item on sale.
discount_value = rate_of_discount *
price
price_after_discount = price –
discount_value
Display
price_after_discount.
END
Learning Outcomes
Answer:
1. Identify input, process and output.
Input : number1, number2
Process : Calculate product = number1 x
number2
Output : product
2. Pseudocode
3. Flowchart
Construct flowchart
integer*/
scanf("%d", &integer2); /*read user input*/
sum=integer1 + integer2; //addition between
integer1 and
integer2
/syntax errors
QUIZ 1
Define programme, programmer,
programming language.
Describe various types of programming
languages.
Explain the flowchart symbols.
Compared the advantages and
disadvantages of flowcharts.
Construct flowcharts for the given problem.
Apply flowchart for sequence, selection and
looping structure.
92