summaryrefslogtreecommitdiff
path: root/wk2/sect2
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-06 04:44:02 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-06 04:44:02 +0000
commitc0bb8f888e7a7826fba29329e471e41ee6d741a2 (patch)
tree285c3023ce5a840fb75baa93a9eebc0903c838d5 /wk2/sect2
parentb88da46eace37517325e9f7890a561d8af5e7e41 (diff)
Tue, Dec 5, 2023, 8:44 PM -08:00
Diffstat (limited to 'wk2/sect2')
-rw-r--r--wk2/sect2/array.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/wk2/sect2/array.c b/wk2/sect2/array.c
index 14655f6..bece42f 100644
--- a/wk2/sect2/array.c
+++ b/wk2/sect2/array.c
@@ -11,13 +11,11 @@ int main(void)
while (n < 1);
int array[n];
array[0] = 1;
- for (int i = 0; i < n; )
+ for (int i = 1; i < n; i++)
{
array[i] = array[i - 1] * 2;
- i++;
}
- while (i < n);
- for (int j = 0; j < n; j++)
+ for (int i = 0; j < n; j++)
{
printf("%i\n", array[j]);
}