Last active
November 10, 2024 17:13
-
-
Save abhitheawesomecoder/7b889fa39dbc5d89038ae0f4653311ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fibonaci series using recursion | |
void main() { | |
seq(5); | |
} | |
seq(int n){ | |
if(n < 0){ | |
return n; | |
}else{ | |
if(n < 2) | |
print(n); | |
else | |
print((n-1)+(n-2)); | |
return seq(n-1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment