Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define N 5
- int func_A(int vec[N], int t)
- {
- int i;
- int num = 0;
- if ((t < 0) || (t > N - 1))
- return 0;
- if (t == 0)
- num = vec[t];
- for (i = t + 1; i < N; i++)
- {
- num -= vec[i];
- return (num + func_A(vec, ++t));// -> func_A(vec, ++t) לא כל כך מבין מה חוזר מכאן כל פעם
- }
- }
- int main()
- {
- int vec[N] = { 15,1,1,1,1 };
- int res;
- res = func_A(vec, 0);
- printf("res = %d\n", res);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement