C# Girilen Sayıların Tek-Çift Sayısının Bulunması

Konu sahibi son olarak 3315 gün önce görüldü
Kod:
int a, b, c,tek_sayi=0,cift_sayi=0 ;
Console.WriteLine("1. sayi girin");
a = Convert.ToInt32(Console.ReadLine());
if (a % 2 == 0)
{
++cift_sayi;
}
else
{
++tek_sayi;
 
}
Console.WriteLine("2. sayi girin");
b = Convert.ToInt32(Console.ReadLine());
if (b % 2 == 0)
{
++cift_sayi;
}
else
{
++tek_sayi;
 
}
Console.WriteLine("3. sayi girin");
c = Convert.ToInt32(Console.ReadLine());
if (c % 2 == 0)
{
++cift_sayi;
}
else
{
++tek_sayi;
 
}
 
Console.WriteLine("tek sayilar={0},çift sayilar={1}", tek_sayi, cift_sayi);
Console.ReadLine();
 
Geri