+ 3

Let's odd code coach problem in C

My code failed in case 4 and 5. What's the problem in my code? Please help #include <stdio.h> int main() { int a,b=0; while(scanf("%d",&a)!=EOF){ if(a%2==0){ b+=a; } }printf("%d",b); return 0; }

14th Mar 2020, 8:02 PM
高于鈞
高于鈞 - avatar
3 Antworten
+ 10
Read the description again: "The first input denotes the length of the list (N)." You don't have tu add the first number.
14th Mar 2020, 8:18 PM
Kevin ★
+ 4
Kevin Star Thanks!I will see the question clearly next time😂
14th Mar 2020, 8:30 PM
高于鈞
高于鈞 - avatar
+ 3
Marcin Wiśniewsk Don't spam.
18th Mar 2020, 12:19 PM
Kevin ★