Page 71 - 2502_Pakistan-kifayat_C-8
P. 71
Example of Pseudocode for Simple Problems
Pseudocode helps us write the steps of a solution in a clear and simple way before turning it into a real
computer program.
Some examples of pseudocode are mentioned below:
Example 9: Finding the Sum of Two Numbers
Start
Input number A
Input number B
Add A and B, store in Result
Print Result
End
Example 10: Find the Largest of Two Numbers
Start
Input numbers A and B
If A > B
Print "A is greater"
Else
Print "B is greater"
End
Example 11: Write a pseudocode to check if a number is divisible by 4 and 10.
Start
Input number N
If N mod 4 = 0 AND N mod 10 = 0 then
Print "The number is divisible by 4 and 10"
Else
Print "The number is not divisible by 4 and 10"
End
In the above pseudocode, mod stands for modulus, which gives the remainder when one number is
divided by another. AND is a logical operator that checks if two or more conditions are true at the same
time.
#Solving Complex Problems 69

