immuntasir

Untitled

Oct 8th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. #include <stdio.h>
  2. int sum(int ara[], int n) {
  3. if (n==1) return ara[0];
  4. return ara[0] + sum(ara+1, n-1);
  5. }
  6. int main() {
  7. int ara[] = {1, 2, 3, 4, 5};
  8. printf("%d\n", sum(ara, 5));
  9. return 0;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment