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