Cannot implicitly convert type 'int' to 'bool' - C#
Формулировка задачи:
Как бороться с несовместимостью двух типов? d задавать как bool не вариант, т.к. там значения только t и f, как правильно сравнивать в if?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _8
{
class Program
{
static void Main(string[] args)
{
int a = 1, s = 1, n;
int d;
Console.WriteLine("Введите количество чисел");
n = Convert.ToInt32(Console.ReadLine());
s = 1;
while (a <= n)
{
d = a % 2;
if (d = 0) { s = s * a; }
a += 1;
}
Console.WriteLine("Произведение первых нечетных n чисел равно " + s);
Console.ReadKey();
}
}
}Решение задачи: «Cannot implicitly convert type 'int' to 'bool'»
textual
Листинг программы
if (d == 0) { s = s * a; }
a += 1;