I have written a small code, it works right on VS, but the problem arises when it is to be submitted online, so it needs input formatted in same line.
Format needs an N integer taking no of Numbers in List Next Line needs N no of elements in same line separated by space the next one should output the sum. I have done that, but there is an problem, it does not let me input no greater than 87, it gives me NumberFormatException at line 17. To get array content in one line I took it from here: Reading array elements from the same line (C#) Newbie in C#, was doing it in Java.
class MyClass {
static void Main(string[] args) {
int i,k;
int sum=0;
int n;
n = Convert.ToInt32(Console.ReadLine());
//Took this code from above link
string readLine = Console.ReadLine();
string[] stringArray = readLine.Split(' ');
int[] intArray = new int[100];
for (i = 0; i < n; i++)
{
intArray[i] = int.Parse(stringArray[i]); // line 17
}
for (k = 0; k <= n; k++)
{
sum = sum + k;
}
Console.WriteLine(sum);
}