Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
how isn't it working...
please help me guys with what happenig here... my coding isnt that good. public class Program { public static void main(String[] args) { int[] n = { 0,1,2,3,4,5,6,7,8,9 }; int sum = 0; int c = 0; for (int i = 1; i <= n.length; i++) { if (i%2 == 0) { sum += i; c++; } } System.out.println(sum); } }
4 Antworten
0
its for adding even numbers from a list
0
what do you want to do? 🤔
0
i want to add all the even numbers in that array
0
wow, its working on my ide but sololearn is rejecting the answer, i dont know why...