{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Sum sum count when do we stop very important the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: count print sum Stop 6 2 13 ­09 ­19 A while loop • It is like a repeLLve “if” statement—while the Boolean expression is true, execute the code block while BOOLEAN EXPRESSION : BLOCK <next statement> TRUE count<= N? sum = sum + count • When do we stop?   VERY IMPORTANT! The Boolean expression has to evaluate to false at some point, otherwise the loop goes on forever! 7 Solving Gauss’s problem with repe$$on • Add them all up! TRUE count<= N? sum = sum + count ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online