using System;
class Program
{
public static void Main()
{
int Num;
Console.WriteLine("Enter a number to check its even or odd");
Num = int.Parse(Console.ReadLine());
if (Num > 0)
{
if (Num % 2 == 0)
{
Console.WriteLine("{0} is a even Number", Num);
}
else
{
Console.WriteLine("{0} is a odd number", Num);
}
}
else
{
Console.WriteLine("{0} is a negative number and negative number can't be even or odd",Num);
}
}
}
class Program
{
public static void Main()
{
int Num;
Console.WriteLine("Enter a number to check its even or odd");
Num = int.Parse(Console.ReadLine());
if (Num > 0)
{
if (Num % 2 == 0)
{
Console.WriteLine("{0} is a even Number", Num);
}
else
{
Console.WriteLine("{0} is a odd number", Num);
}
}
else
{
Console.WriteLine("{0} is a negative number and negative number can't be even or odd",Num);
}
}
}
No comments:
Post a Comment