This question has already been answered:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp66 { class Program { static void Main(string[] args) { int sum = 0; Console.WriteLine("Enter the dimension of array: "); int a = Convert.ToInt32(Console.ReadLine()); int[] A = new int[a]; for (int i = 0; i < A.Length; i++) { Console.WriteLine("Enter the number: "); A[i] = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < A.Length; i++) { if (A[i] % 2 == 1) { sum += A[i]; } } Console.WriteLine("Sum of all no paired elements of array - {0}", sum); } } }
A[i] % 2for negativeA[i]. - VladD