Last active
January 29, 2022 18:44
-
-
Save wmcnamara/e8d332964c6eaa262a148db8f8a35739 to your computer and use it in GitHub Desktop.
Recursively counts from min to max
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
#include <iostream> | |
void countFrom(int min, int max) | |
{ | |
if (min > max) | |
return; | |
std::cout << min << '\n'; | |
countFrom(min + 1, max); | |
} | |
int main () | |
{ | |
countFrom(0, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment