using System;
using System.Collections;
using System.Collections.Generic;
namespace CSLear
{
class Program
static void Main(string[] args)
var InputStream = ReadSeqWhile(x => x != 0);
foreach (int item in InputStream)
if (item % 2 != 0) { Console.WriteLine(item); }
}
public static IEnumerable<int> ReadSeqWhile(Func <int, bool> Predicate)
var rtemp = int.Parse(Console.ReadLine());
while (Predicate(rtemp))
yield return rtemp;
rtemp = int.Parse(Console.ReadLine());
Объяснение:
using System;
using System.Collections;
using System.Collections.Generic;
namespace CSLear
{
class Program
{
static void Main(string[] args)
{
var InputStream = ReadSeqWhile(x => x != 0);
foreach (int item in InputStream)
{
if (item % 2 != 0) { Console.WriteLine(item); }
}
}
public static IEnumerable<int> ReadSeqWhile(Func <int, bool> Predicate)
{
var rtemp = int.Parse(Console.ReadLine());
while (Predicate(rtemp))
{
yield return rtemp;
rtemp = int.Parse(Console.ReadLine());
}
}
}
}
Объяснение: