Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int addSubarray(int x[], int from, int to){
- if (from==to) {
- return x[from];
- }
- return addSubarray(x, from+1, to)+x[from];
- }
- int main(){
- int x[]={5, 2, 6, 9, -5, 0};
- printf("%i", addSubarray(x, 1, 3));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment