testFile with fibonacci program
This commit is contained in:
parent
62f9580aee
commit
cb61c7d395
1 changed files with 19 additions and 8 deletions
27
testFile
27
testFile
|
@ -1,9 +1,20 @@
|
||||||
int main(){
|
int main() {
|
||||||
int a, d;
|
int i, n, nextTerm, t1, t2;
|
||||||
int b, c = 2;
|
|
||||||
b = a;
|
i = 0;
|
||||||
a = b +2;
|
n = 20; // put here the number you want !
|
||||||
a = c;
|
|
||||||
a = 5;
|
t1 = 0;
|
||||||
c = 19 + 2 - (5 * a + 8) * 2;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue