How to Verify EVEN or ODD Number Using C#
Submitted by janobe on Thursday, November 15, 2018 - 18:52.
In this tutorial, let’s learn how to verify the Even or Odd number using C#. This is just a simple program that you can easily understand and work on. For verifying whether the number is an Even or Odd, all you have to do is simply input any number that you like then press ENTER to execute the program and the result will tell you if it’s an Even or Odd number.
Full source code.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.
Creating Console Application
Step 1
Open Microsoft Visual Studio 2015 and create a new console application in c#.Step 2
Create a code to verify the EVEN and ODD number.- int n;
- Console.Write("Input a Number : ");
- n = int.Parse(Console.ReadLine());
- if (n % 2 == 0)
- {
- Console.Write("The Number " + n + " is an Even Number");
- Console.Read();
- }
- else
- {
- Console.Write("The Number " + n + " is an Odd Number");
- Console.Read();
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n;
- Console.Write("Input a Number : ");
- n = int.Parse(Console.ReadLine());
- if (n % 2 == 0)
- {
- Console.Write("The Number " + n + " is an Even Number");
- Console.Read();
- }
- else
- {
- Console.Write("The Number " + n + " is an Odd Number");
- Console.Read();
- }
- }
- }
- }
Add new comment
- 132 views