Last active
March 23, 2022 18:23
-
-
Save bakhbk/f5774da5ce9ca3f5e2719ce1d29a348e 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
void main() { | |
print(fact(5)); // 120 | |
} | |
int fact(int x) { | |
if (x == 1) { | |
return 1; | |
} else { | |
return x * fact(x - 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment