From cb61c7d395516090fa095f004eee6c86ec9d151e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20LACROIX?= Date: Wed, 31 May 2023 16:47:20 +0200 Subject: [PATCH] testFile with fibonacci program --- testFile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/testFile b/testFile index d572de9..b79b1bd 100644 --- a/testFile +++ b/testFile @@ -1,9 +1,20 @@ -int main(){ - int a, d; - int b, c = 2; - b = a; - a = b +2; - a = c; - a = 5; - c = 19 + 2 - (5 * a + 8) * 2; +int main() { + int i, n, nextTerm, t1, t2; + + i = 0; + n = 20; // put here the number you want ! + + t1 = 0; + t2 = 1; + + nextTerm = t1 + t2; + + n = n - 3; // cause nextTerm already contains the 3rd term + while (i <= n){ + t1 = t2; + t2 = nextTerm; + nextTerm = t1 + t2; + i = i+1; + } } +