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

Pseudo Code

Uploaded by

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

Pseudo Code

Uploaded by

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

PSEUDOCODE

PSEUDOCODE
• Pseudocode is an artificial and informal language that helps
programmers develop algorithms.
• It is intended for human reading and cannot be executed directly by
the computer
• Pseudocode uses six programming constructs (always written in
uppercase): SEQUENCE, CASE, WHILE, REPEAT-UNTIL, FOR, and
IF-THEN-ELSE. These constructs — also called keywords —are used to
describe the control flow of the algorithm.
HOW TO WRITE PSEUDOCODE

1. Always capitalize the initial word


2. Make only one statement per line.
3. Indent to show hierarchy, improve readability, and show nested
constructs.
4. Always end multi-line sections using any of the END keywords
(ENDIF, ENDWHILE, etc.).
5. Keep your statements programming language independent.
PSEUDOCODE
CONSTUCTS
Pseudocode to Add Two Numbers
BEGIN
INPUT s1.
INPUT s2.
COMPUTE sum=s1+s2.
OUTPUT sum
END
Pseudocode to find the largest of two numbers
BEGIN
INPUT num1,num2
IF (num1>num2) THEN
PRINT num1
ELSE
PRINT num2
ENDIF
END
Pseudocode to find sum of first n natural numbers

BEGIN
SET i =1
SET sum=0
WHILE (i <=100)
COMPUTE sum=sum + i
INCREMENT i
ENDWHILE
END

You might also like