From 32372efe47fddfb8ac9019b6e931549cab0543ae Mon Sep 17 00:00:00 2001 From: "nshizirungudieumerci@gmail.com" Date: Fri, 14 Aug 2026 15:56:45 -0400 Subject: [PATCH] added a parsons problem to section 3.3 for loops --- pretext/Control_Structures/for_loop.ptx | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pretext/Control_Structures/for_loop.ptx b/pretext/Control_Structures/for_loop.ptx index 1c70c23..69eb92a 100644 --- a/pretext/Control_Structures/for_loop.ptx +++ b/pretext/Control_Structures/for_loop.ptx @@ -111,6 +111,47 @@ int main() { + + + +

+ Construct a C++ program that uses a for loop to print the squares of the numbers + 0 through 4, each followed by a space. Drag the blocks into the correct order on the right. +

+
+ + + #include <iostream> + using namespace std; + + + + int main() { + + + + + for (int i = 0; i < 5; i++) { + + + for (int i = 0; i < 5; i--) { + + + + + cout << i*i << " "; + + + + } + + + + return 0; + } + + +
\ No newline at end of file