That's odd | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

That's odd

Please correct my code. Можно и на русском. https://code.sololearn.com/cvKuOyLPjcdo/?ref=app

29th Mar 2020, 6:56 AM
GAG98
GAG98 - avatar
6 Answers
+ 1
That's odd... +50 XP You want to take a list of numbers and find the sum of all of the even numbers in the list. Ignore any odd numbers. Task: Find the sum of all even integers in a list of numbers. Input Format: The first input denotes the length of the list (N). The next N lines contain the list elements as integers. Output Format: An integer that represents the sum of only the even numbers in the list. Sample Input: 9 1 2 3 4 5 6 7 8 9 Sample Output: 20
29th Mar 2020, 7:36 AM
GAG98
GAG98 - avatar
+ 3
You can be more specific, if you do not clarify what is wrong, nobody can understand what you need.
29th Mar 2020, 7:34 AM
Cmurio
Cmurio - avatar
0
So the code doesn’t work anyway
29th Mar 2020, 7:33 AM
GAG98
GAG98 - avatar
0
You have multiple outputs because you print the result at the for loop.
29th Mar 2020, 9:02 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
Can you correct code? I tried, but nothing came of it.
29th Mar 2020, 2:02 PM
GAG98
GAG98 - avatar
0
You just need to move Console.WriteLine() out of the for loop. Not a pretty big change.
29th Mar 2020, 2:36 PM
你知道規則,我也是
你知道規則,我也是 - avatar