A simple even-odd number program in C#. If number is completely divisible by 2 and remainder remain 0, then it is even number. If remainder not remain 0 then it is odd number.
2, 4, 6, 8, 10, 12, etc..
1, 3, 5, 7, 8, 9, 11, etc.
using System; using System.Collections.Generic; using System.Text; namespace even_odd { class Program { static void Main(string[] args) { int q; Console.WriteLine("ENTER ANY NUMBER :- "); q = Convert.ToInt32(Console.ReadLine()); if (q % 2 == 0) { Console.WriteLine("ENTER NUMBER IS EVEN."); } else { Console.WriteLine("ENTER NUMBER IS ODD."); } Console.ReadLine(); } } }
ENTER ANY NUMBER :- 5 ENTER NUMBER IS ODD.