Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- long sum(long i)
- {
- if(i==1)
- {
- return i;
- }
- else
- {
- return i+sum(i-1);
- }
- }
- int main()
- {
- long i;
- scanf("%ld",&i);
- printf("%ld",sum(i));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement