summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]);
}