+ 5

How do i enter input for this code? I find it hard to enter input in sololearn #code_playground.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { Console.Write("Enter a positive integer: "); int n = int.Parse(Console.ReadLine()); int[] array = new int[n]; Console.WriteLine("Enter the values of the array:"); for (int i = 0; i < n; i++) { array[i] = int.Parse(Console.ReadLine()); } bool symmetric = true; for (int i = 0; i < array.Length/2; i++) { if (array[i] != array[n - i - 1]) { symmetric = false; break; } } Console.WriteLine("Is symmetric? {0}", symmetric); } } }

14th Mar 2017, 1:29 PM
Wilson Bol
Wilson Bol - avatar
1 Resposta
+ 11
You need to input all the values for ReadLine at the start of the program, separated by line break.
14th Mar 2017, 6:16 PM
Tashi N
Tashi N - avatar