Skip to content

Instantly share code, notes, and snippets.

@psaruks
Created January 26, 2020 21:39
Show Gist options
  • Save psaruks/366a6ad306438dea20175ec17a273ad0 to your computer and use it in GitHub Desktop.
Save psaruks/366a6ad306438dea20175ec17a273ad0 to your computer and use it in GitHub Desktop.
int zeroCount = 0;
double reiz = 1;
for (int x = 0; x < n; x++) {
if (arr[x] == 0) {
zeroCount++;
}
if (zeroCount == 2) {
break;
}
if (zeroCount == 1 && arr[x] != 0) {
reiz *= arr[x];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment