Definition, Rules for writing, Advantages, Disadvantage, Examples Pseudocode Problem | Python Programming - Pseudocode | Problem Solving and Python Programming : Algorithmic Problem Solving

Chapter: Problem Solving and Python Programming : Algorithmic Problem Solving

Pseudocode

“Pseudo” means initiation or false.

PSEUDOCODE

 

Definition:

 

·           “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.

 

Rules for writing Pseudocode

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.

 

Advantages

• 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.

 

Disadvantage

• 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.

 

Examples Pseudocode

 

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

 

Tags : Definition, Rules for writing, Advantages, Disadvantage, Examples Pseudocode Problem | Python Programming , Problem Solving and Python Programming : Algorithmic Problem Solving
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Problem Solving and Python Programming : Algorithmic Problem Solving : Pseudocode | Definition, Rules for writing, Advantages, Disadvantage, Examples Pseudocode Problem | Python Programming

Related Topics

Problem Solving and Python Programming : Algorithmic Problem Solving


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.