Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. int x=0;
  3. int fun(int n)
  4. {
  5. if(n>0)
  6. {
  7. x++;
  8. return fun(n-1)+x;
  9. }
  10. return 0;
  11. }
  12.  
  13. int main()
  14. { int r;
  15. r=fun(5);
  16. printf("%d\n",r);
  17. r=fun(5);
  18. printf("%d\n",r);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement