+ 1
[Solved] Thatâs odd... problem (Code Coach)
Could you please take a look at my code, i believe it should work but the SoloLearn app says it otherwise. #include <stdio.h> #include <stdlib.h> int main() { int len, i; int sum = 0; int *arr; scanf("%d", &len); arr = (int*) malloc(len * sizeof(int)); for(i=0; i < len; i++) { scanf("%d", arr+i); if(*(arr+i)%2 == 0){ sum += *(arr+1); } } printf("%d", sum); free(arr); return 0; } Thank you!
2 Answers
+ 3
It should be
sum += *(arr+i);
+ 1
Ok, it seems i am blind. Thank you very much! :)