Pseudocode

1 / 17

# Pseudocode - PowerPoint PPT Presentation

C Programming Technique – Firdaus-Harun.com. Pseudocode. Agenda. Intro to Pseudocode Pseudocode vs Flowchart Technique – Write pseudocode Examples. What’s Pseudocode ?. Artificial and Informal language Helps programmers to plan an algorithm Similar to everyday English

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Pseudocode' - alexavier

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Agenda
• Intro to Pseudocode
• Pseudocode vs Flowchart
• Technique – Write pseudocode
• Examples
What’s Pseudocode ?
• Artificial and Informal language
• Helps programmers to plan an algorithm
• Similar to everyday English
• Not an actual programming language
E.g : Pseudocode

Calculate C = A*B

Display C

Stop

Technique
• Do not write Start in every pseudocode
• Parallelogram – Read / Get OR Display / Print
• Rectangle – Specify the actions
• E.g:
• Calculate A = B + C OR A equals to B plus C
• Average = total / count
• Final price equals price of item plus sales tax
• Diamond – [Next »]
Technique (..Cont.)
• Diamond
• Selection – IF , IF / ELSE and IF / ELSE IF

IF A is less than B

BIG = B

SMALL = A

ELSE

BIG = A

SMALL = B

• Repetition – WHILE / DO/WHILE / FOR [Next example]
Comparative Between Flowchart vsPseudocode
• Flowchart
• A graphical way of writing pseudocode
• Rounded rectangle – terminal
• Parallelogram – input / output
• Rectangle – actions
• Diamonds – decision / conditional
• Circles – connector

Start Terminal.

Program start

here

Stop Terminal

Program end

here

Input.

Enter values for

A and B

Process

Output

E.g : Flowchart
Comparative Between Flowchart vsPseudocode (..Cont.)
• Pseudocode
• No syntax rule – Independent from any programming language
• Write in an ordinary language
• Uses a structure resembling computer structure
• No connector between pages
E.g : Pseudocode

Calculate C = A*B

Display C

Stop

E.g : Pseudocode

Calculate C = A*B - Action

Display C - Output

Stop - Terminal

Example 2 (Selection)

IF A is less than B

BIG = B

SMALL = A

ELSE

BIG = A

SMALL = B

Write / Display BIG, SMALL

Stop

Example 2 (Selection)

IF A is less than B - Selection

BIG = B - Action

SMALL = A - Action

ELSE - Selection

BIG = A - Action

SMALL = B - Action

Write / Display BIG, SMALL - Output

Stop - Terminal

Example 3 (Repetition)

Set count to zero

Set total to zero

WHILE ( not end-of-data )

increment count by 1

total = total + number

IF ( count > 0 ) then

average = total / count

Display average

Stop