Professional Documents
Culture Documents
(FoCS)
L-04: PseudoCode
• Pseudo code is a generic way of describing an algorithm without the use of any
specific programming language syntax.
• It is, as the name suggests, pseudo code —it cannot be executed on a real computer,
but it models and resembles actual programming code, and is written at roughly the
same level of detail.
• Pseudo code, by nature, exists in various forms, although most borrow syntax from
popular programming languages (like C programming language).
• Use of standard programming structures such as if, if-else, for, while, and cases for
writing the pseudocodes.
3
Pseudocode for addition of two integer numbers:
4
Pseudocode to check whether the number is Odd or Even:
1. Even_Odd(number)
2. Begin
3. DISPLAY "Enter the Number - "
4. READ number
5. IF (number MOD 2 == 0) THEN
DISPLAY "Number is Even"
ELSE
DISPLAY "Number is Odd"
END IF
6. End
5
Pseudocode for sum and average of three numbers:
6
Pseudocode for print the numbers from 1 to N:
1. Display(num1, num2)
2. Begin
3. Set num1=0
3. WRITE “Please enter the value of num2”
4. READ num2
5. Begin FOR()
6. IF (num1 < num2) THEN
num1= num1 + 1
DISPLAY “num1“
ELSE
Terminate
END IF
7. END FOR()
8. End 7
Q1. Write a pseudocode to check the largest number between the
two numbers?
8
Thank You