Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
GC collects object in scope
line 1 syntax error
Importent Gen_Coverent Example-1
C# - Date Validation
a.k.java
The abstract factory design pattern implemented in c# using generics.
ProgramDemo
1
custom Queue Implementation
mysrc.tcl
Please log in to post a comment.