summaryrefslogtreecommitdiff
path: root/wk2/sect2
diff options
context:
space:
mode:
Diffstat (limited to 'wk2/sect2')
-rw-r--r--wk2/sect2/array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/wk2/sect2/array.c b/wk2/sect2/array.c
index 708ac0f..f6f2609 100644
--- a/wk2/sect2/array.c
+++ b/wk2/sect2/array.c
@@ -11,13 +11,15 @@ int main(void)
while (n < 1);
int array[n];
array[0] = 1;
- printf("1\n");
int i = 1;
do
{
array[i] = array[i-1] * 2;
- printf("%i\n", array[i]);
i++;
}
while (i < n);
+ for (int j = 0; j < n; j++)
+ {
+ printf("%i\n", array[j]);
+ }
}