Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #define N 5
  3. int func_A(int vec[N], int t)
  4. {
  5.     int i;
  6.     int num = 0;
  7.  
  8.     if ((t < 0) || (t > N - 1))
  9.         return 0;
  10.     if (t == 0)
  11.         num = vec[t];
  12.  
  13.     for (i = t + 1; i < N; i++)
  14.     {
  15.         num -= vec[i];
  16.         return (num + func_A(vec, ++t));// ->  func_A(vec, ++t) לא כל כך מבין מה חוזר מכאן כל פעם
  17.     }
  18.  
  19. }
  20.  
  21. int main()
  22. {
  23.     int vec[N] = { 15,1,1,1,1 };
  24.     int res;
  25.  
  26.     res = func_A(vec, 0);
  27.     printf("res = %d\n", res);
  28.     return 0;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement