Chapter 19: Problem 22
Read the following algorithm: 10 Let \(\mathrm{P}=1\), Sum \(=0\) 20 If \(\mathrm{P} \leq \mathrm{N}\), then \((\mathrm{N}\) is the given Number) 30 Sum \(=\) Sum \(+\mathrm{P}\) 40 \(\mathrm{P}=\mathrm{P}+1\) 50 Repeat this loop 60 End Above algorithm is used to ______. (1) find first \(\mathrm{N}\) natural numbers (2) find sum of first \(\mathrm{N}\) natural numbers (3) find the sum of first \(\mathrm{N}\) even numbers (4) find the sum of first \(\mathrm{N}\) odd numbers
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.