Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int findSumOrMult(int arr[], int n, char type) {
- int result = type == 's' ? 0 : 1;
- for(int i = 0; i < n; i++) {
- if(type == 's') result += arr[i];
- else result *= arr[i];
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement