Exercises · Q13
Q.List the steps of a good problem-solving procedure in programming, and write an algorithm to find the larger of two numbers.
ChseodishaTextbookSubjectiveImportance★★★★★est
100% · 13/13 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Good problem-solving procedure. Experienced programmers do not begin by typing code. They follow a sequence:
- Understand the problem — identify the inputs, the required output, and the rules linking them.
- Design a solution — express the logic as an algorithm (numbered plain-language steps) or a flowchart (a diagram of the logic).
- Code — translate the design into Java.
- Test — run with sample data, including tricky edge cases, and check the output against what is expected.
- Debug and refine — locate and fix errors, then test again.
Algorithm — find the larger of two numbers:
Step 1: Start
Step 2: Read the two numbers A and B
Step 3: If A > B, then print A as the larger
Step 4: Otherwise, print B as the larger
Step 5: Stop
``` …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.