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