nested_loop - { cin >> num sum += num...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 // nested loop example #include <iostream> using namespace std int main() { int row = 0 int col = 0 int num = 0 int sum = 0 for (row = 4 row >=1 row--) { for (col = 3 col >= 1 col--)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { cin &gt;&gt; num sum += num if (num == 13) { cout &lt;&lt; &quot;You get an A and everyone goes home&quot; &lt;&lt; endl row = -9 break } } } cout &lt;&lt; &quot;sum is &quot; &lt;&lt; sum &lt;&lt; endl return 0 }...
View Full Document

Ask a homework question - tutors are online