Created
September 9, 2016 13:27
-
-
Save rohan-varma/e85ba84b1287be8a7f6b58a5e98816c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getProduct(int* arr, int len, int index) { | |
//return product of all ints except at that index | |
int prod = 1; | |
for(int i = 0 ; i < len; i++) { | |
if(i!=index) { | |
prod*=arr[i]; | |
} | |
} | |
return prod; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment