PSEUDOCODE
·
“Pseudo” means initiation or false.
·
“Code” means the set of statements or instructions
written in a programming language.
·
Pseudocode is also called as “Program Design
Language [PDL]”.
·
Pseudocode is a Programming Analysis Tool, which is
commonly used for planning he program logic.
·
Pseudocode is written in normal English and cannot
be understood by the computer.
·
Set of instructions that mimic programming language
instructions
·
An informal high-level description of the operating
principle of a computer program. It uses the structural conventions of a
programming language, but is intended for human reading rather than machine
reading.
1. Write
one statement per line
2.
Capitalize initial keywords (READ, WRITE, IF, WHILE, UNTIL).
3. Indent
to show hierarchy.
4. End
multiline structure.
5. Keep
statements language.
• It can be done easily in any word
processor.
• It can be easily modified as compared
to flowchart.
• Its implementation is very useful
in structured design elements.
• It can be written easily.
• It can be read and understood
easily.
• Converting a pseudocode to
programming language is very easy compared with converting a flowchart to
programming language.
• It is not visual.
• We do not get a
picture of the design.
• There is no standardized style or
format.
• For a beginner, it is more
difficult to follow the logic or write pseudocode as compared to flowchart.
Problem
1: Calculate sum and average for n numbers.
BEGIN
INITIALIZE
sum=0, i=1
READ n
FOR i
<=n, then
COMPUTE
sum = sum +i
CALCULATE
i=i+1
END FOR
COMPUTE
avg = sum/n
PRINT
sum, avg
END
Problem
2: Calculate area of circle
BEGIN
READ
radius, r
INITIALIZE
pi=3.14
CALCULATE
Area=pi * r *r
PRINT
Area
END
Problem
3: Read Number n and print the integers
counting upto n
BEGIN
READ n
INITIALIZE
i to 1
FOR i
<= n, then
DISPLAY i
INCREMENT
i
END FOR
END
Problem
4: Find the greater number between two numbers.
BEGIN
Read A, B
IF A is
less than B
BIG = B
SMALL = A
ELSE
BIG = A
SMALL = B
WRITE /
DISPLAY BIG, SMALL
END
Problem
5: To determine a student whether successful or fail.
BEGIN
READ
student ‘s grade
IF
student's grade is greater than or equal to 50
Print
"passed"
ELSE
Print
"failed“
END
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.