Practical Programming -L04
Practical Programming -L04
FOR i = 2 TO SQRT(n) DO
IF n % i == 0 THEN
RETURN FALSE
END IF
END FOR
7. Common Mistakes to Avoid
• Common Mistakes and How to Avoid Them
• Mistake 1: Using language-specific syntax (e.g., cout or printf).
• Solution: Stick to generic constructs like WRITE and READ.
• Mistake 2: Forgetting to capitalize constructs.
• Solution: Always capitalize keywords like IF, WHILE, FOR, etc.
• Mistake 3: Not using indentation.
• Solution: Use indentation to show hierarchy and improve
readability.
• Mistake 4: Writing overly complex pseudocode.
• Solution: Keep it simple and focus on clarity.
8. Summary
• Pseudocode is a powerful tool for designing algorithms.