Question

How to write algorithm and draw flowchart for finding the sum of first ten even numbers?

Answers

oobleck
Just think about what you'd do. Move down the list of even numbers, adding each to the sum. Stop after you've added up 10 of them.
How do you get just the even numbers? Start with the first (2) and keep adding 2 each time.
sum=0
n=2
for i=1..10
sum +=n
n +=2
next i
Catherine
Create a flowchart that will display the sum of all even numbers from 1-10
Shurthi
Start
X=2
If X>=10 Yes= stop
No= display X
X=X+2
Its a loop structure

Related Questions