Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
array with c#
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int SubTable(int[] tableau){ int x =0; int y = 0; if (tableau == null){ return 0; }else{ for (int i=0; i<tableau.Length; i++) { if (tableau[i] % 2 == 0){ y += tableau[i];} if (tableau[i] % 2 == 1){ x += tableau[i];} } return x-y; } } int[] Alex = new int[] {3, 2, 3, 4}; Console.WriteLine(SubTable(Alex)); } } }
run
|
edit
|
history
|
help
0
Array 10th grade
25
asxsd
eg
asxs sxsd
Sum of 3
I know it's a bit combersome, but it's my first attempt.
sdfrgthyjukioikujyhtgrfds
Fórum ➡ Building a List<> with questions and answers, from data in TXT file, using LINQ ♦
Remove Duplicates - Asif Ali