1. Design an algorithm and the corresponding flowchart for finding the sum the numbers 2, 4, 6, 8,…n
Answers
Answered by
2
Answer:
An algorithm and the flowchart for finding the sum of the numbers 2, 4, 6, 8, ..., n
Algorithm:-
Step 1. Start
Step 2. Declare numeric variables i, n and sum.
Step 3. Initialize sum = 0.
Step 4. Input upper limit says n to calculate the sum of even numbers.
Step 5. Iterate through even numbers using for loop from 2 to n and increment by 2 on each iteration. such as for(i=2; i<=n; i+=2).
compute sum = sum + i.
repeat step 5
Step 6. Print sum
7. End
Flow chart is attached below:-
Explanation:
HOPE THIS HELPS PLEASE MARK AS BRAINLIEST.
Attachments:
Similar questions