Asked by Nishant
How to write algorithm and draw flowchart for finding the sum of first ten even numbers?
Answers
Answered by
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
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
Answered by
Catherine
Create a flowchart that will display the sum of all even numbers from 1-10
Answered by
Shurthi
Start
X=2
If X>=10 Yes= stop
No= display X
X=X+2
Its a loop structure
X=2
If X>=10 Yes= stop
No= display X
X=X+2
Its a loop structure
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.