Created
March 14, 2012 14:30
-
-
Save kdabir/2036868 to your computer and use it in GitHub Desktop.
Sum of first n numbers (recursive)
This file contains hidden or 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
/** sum of first n number */ | |
int add(int num){ | |
return (num)?num + add(num-1):num; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment