Advertisement
Stoycho_KK

Untitled

Nov 15th, 2021
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int findSumOrMult(int arr[], int n, char type) {
  2. int result = type == 's' ? 0 : 1;
  3. for(int i = 0; i < n; i++) {
  4. if(type == 's') result += arr[i];
  5. else result *= arr[i];
  6. }
  7. return result;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement