C# Array - Count the Odd Numbers
using System;
namespace ConsoleApp9
{
class Program
{
static void Main(string[] args)
{
var numbers = Console.ReadLine().Split(' ');
var findTheOdd = new int[numbers.Length];
for (int i = 0; i < numbers.Length; i++)
{
findTheOdd[i] = int.Parse(numbers[i]);
}
int oddCounter = 0;
for (int i = 0; i < findTheOdd.Length; i++)
{
if (findTheOdd[i] % 2 == 1 || findTheOdd[i] % 2 == -1)
{
oddCounter++;
}
}
Console.WriteLine(oddCounter);
}
}
}
Comments