+ 1

Is this a proper recursive function?

int sum(int i){ If (i==0) return 0; else if (i>100){ return i + sum(i+(i-1); } }

28th Feb 2019, 12:14 AM
mya
mya - avatar
1 ответ
+ 5
Yes. I see one brucket is missing also I am not a fun calling user defined function sum as it can already exists.
28th Feb 2019, 12:20 AM
Hubert Dudek
Hubert Dudek - avatar