+ 2

Fibonacci Sequence not Giving Proper Output

Fibonacci Series in C Language. I tested the Code in Turbo++, it worked successfully without an error but when I tested it in SoloLearn Code Playground, it is showing error. https://code.sololearn.com/ca211487a23A/?ref=app

9th Feb 2021, 8:22 AM
Abhijith K S
Abhijith K S - avatar
4 Answers
+ 11
Here conio. h header is not used #include<stdio.h> Int main() { int i, n, t1=0, t2=1, t3; printf("enter the number of terms"); scanf("%d", &n); printf("fibonacci series"); for(i=0;i<n;i++){ printf("%d,", t1); t3=t1+t2; t1=t2; t2=t3; } Return 0; } fixed your code
9th Feb 2021, 8:40 AM
Aysha
+ 5
Abhijith KS Most welcome
9th Feb 2021, 10:05 AM
Aysha
+ 2
Thank you Aysha! It worked successfully
9th Feb 2021, 8:44 AM
Abhijith K S
Abhijith K S - avatar
+ 1
Your code is not working in SoloLearn C Playground because there is no "conio.h" library on the server. I removed "conio.h" lines: https://code.sololearn.com/cMrFsJwInFi0/?ref=app
9th Feb 2021, 8:40 AM
#0009e7 [get]
#0009e7 [get] - avatar