Объясните почему так? - C#
Формулировка задачи:
в этом коде
в строках таких как эта
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string myStr;
Console.WriteLine("Введите первое число");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Введите второе число");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Введите третье число");
int c = int.Parse(Console.ReadLine());
Console.WriteLine("Введите четвертое число");
int d = int.Parse(Console.ReadLine());
int count = 0;
if (a % 2 == 0)
{
count = count + 1;
}
if (b % 2 == 0)
{
count = count + 1;
}
if (c % 2 == 0)
{
count = count + 1;
}
if (d % 2 == 0)
{
count = count + 1;
}
Console.WriteLine("Count = {0}", count);
Console.ReadKey();
}
}
}if (a % 2 == 0)
почему значек прочента [ % ] ,а не деления [ / ]?
и почему если меняешь % на / код не выполняется? Решение задачи: «Объясните почему так?»
textual
Листинг программы
Console.WriteLine("Количество четных = {0}", count);
Console.WriteLine("Количество нечетных = {0}", 4-count);