Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Numbers separated by space
using System; namespace Rextester { public class Program { public static void Main(string[] args) { string input = "1 2 3 4"; string[] inputString = input.Split(' '); int[] intArray = new int[inputString.Length]; for (int i = 0; i < inputString.Length; i++) { intArray[i] = int.Parse(inputString[i]); //Console.WriteLine(intString[i]); } int result = 0; for (int i = 1; i < intArray.Length; i++) { result += intArray[i]; } Console.WriteLine(result); /* string[] userINput = Console.ReadLine().Split(); double a = Convert.ToDouble(userINput[0]); double b = Convert.ToDouble(userINput[1]); double c = Convert.ToDouble(userINput[2]); double d = Convert.ToDouble(userINput[3]); double e = Convert.ToDouble(userINput[4]); double sumOfAll = a + b + c + d + e; Console.WriteLine(sumOfAll);*/ } } }
run
|
edit
|
history
|
help
0
otro
Test3
Vignere Cipher
Polymorphism example
Fórum ➡ Aggregating 2 compatible dictionaries, using LINQ ♦
what do i wrong
C:\Documents and Settings\Админ\Рабочий стол\ШЭ информатика
my cool stuff
work_laba#2
ttttt