Algorithms practice problems
Practice problem 1
Consider the following algorithm:
Step 1: Input a positive integer N.
Step 2: Begin with sum equal to 0 and n equal to 1.
Step 3: Find the neth odd number, which is 2n – 1, and increase sum by this odd number.
Step 4: Increase N by 1.
Step 5: If n > N. then stop and output sum.Otherwise, go back to step 3.
What number does this algorithm output if we input N = 6?
Dractice problem
Answers
Answered by
2
Answer:
36
Explanation:
1+3+5+7+9+11
hope it was helpfull
Similar questions