Nepenthe Posted May 28, 2019 Report Share Posted May 28, 2019 Salut! Am nevoie de ajutor cu problema urmatoare (p.s.: mersi anticipat): https://imgur.com/eX6Zvzx Quote Link to comment Share on other sites More sharing options...
gigiRoman Posted May 28, 2019 Report Share Posted May 28, 2019 Pune codul pentru copy paste. E usor. Quote Link to comment Share on other sites More sharing options...
Nepenthe Posted May 28, 2019 Author Report Share Posted May 28, 2019 @gigiRoman da.. imi citeste 0.. nu stiu de ce. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 28, 2019 Report Share Posted May 28, 2019 (edited) Rezolvare: https://ideone.com/qcW6Yp Tu adunai la suma contorul j, nu elementele din numere. Edited May 28, 2019 by Guest Quote Link to comment Share on other sites More sharing options...
Nepenthe Posted May 28, 2019 Author Report Share Posted May 28, 2019 public static void math4() { int[] numere = { 84, 93, 72, 34, 91, 16, 8, 83, 93, 42 }; int sum = 0; for (int i = 1; i < numere.Length; i += 2) { for(int j = 0; j % 2 == 0; j++) { sum += j; Console.WriteLine("Suma numerelor pare de pe pozitiile impare este " + sum); } } Console.ReadLine(); } Quote Link to comment Share on other sites More sharing options...
Guest Posted May 28, 2019 Report Share Posted May 28, 2019 1 minute ago, aismen said: Rezolvare: https://ideone.com/qcW6Yp Tu adunai la suma contorul j, nu elementele din numere. Just now, Nepenthe said: public static void math4() { int[] numere = { 84, 93, 72, 34, 91, 16, 8, 83, 93, 42 }; int sum = 0; for (int i = 1; i < numere.Length; i += 2) { for(int j = 0; j % 2 == 0; j++) { sum += j; Console.WriteLine("Suma numerelor pare de pe pozitiile impare este " + sum); } } Console.ReadLine(); } Quote Link to comment Share on other sites More sharing options...
Nepenthe Posted May 28, 2019 Author Report Share Posted May 28, 2019 mersi mult! Quote Link to comment Share on other sites More sharing options...