using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AcceptFiveNumberChkEvenOdd
{
class Program
{
static void Main(string[] args)
{
int num1, num2, num3, num4, num5;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Accept five Numbers and Check them for Even or Odd:");
Console.WriteLine("\nEnter the Number");
Console.Write("num1: ");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nEnter the Number");
Console.Write("num2: ");
num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nEnter the Number");
Console.Write("num3: ");
num3 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nEnter the Number");
Console.Write("num4: ");
num4 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nEnter the Number");
Console.Write("num5: ");
num5 = Convert.ToInt32(Console.ReadLine());
if (num1 % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\nnum1 is Even");
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\nnum1 is Odd");
}
if (num2 % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\nnum2 is Even");
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\nnum2 is Odd");
}
if (num3 % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\nnum3 is Even");
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\nnum3 is Odd");
}
if (num4 % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\nnum4 is Even");
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\nnum4 is Odd");
}
if (num5 % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\nnum5 is Even");
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\nnum5 is Odd");
}
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.Write("\n\nTHANK YOU");
Console.ReadLine();
}
}
}
No comments:
Post a Comment