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);
}
}
}
Asked
Active
Viewed 820 times
0
A[i] % 2для отрицательногоA[i]. – VladD Mar 16 '18 at 22:45