Before writing code, a good programmer plans. Decomposition breaks a problem into smaller parts, and abstraction keeps only the details that matter. The plan becomes an algorithm, written as a flowchart or in pseudocode. Standard methods solve common tasks: linear search, bubble sort, totalling, counting and finding the largest or smallest value. Validation checks that input is sensible, and verification checks that it was entered correctly. A trace table follows an algorithm step by step to find its output or its errors. Testing with normal, abnormal, extreme and boundary data shows whether it works.
Lessons, worked problems and more questions on Algorithms and Problem-Solving →Total to and Count to . It then adds Count to Total, adds to Count, and asks Count > 9?. No goes back to the adding step. Yes outputs Total. What is output?Count takes the values , , , , , and each one is added. . After , Count becomes and the loop ends.
stops after , missing the . also adds . adds the even numbers from to and stops there.Log in to join the discussion.
Loading…