Write a program to identify whether the number entered by a user is even or odd.
C# Sharp Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { int n1; Console.WriteLine("Enter a Number"); n1 = Convert.ToInt32(Console.ReadLine()); if (n1 % 2 == 0) { Console.WriteLine("you number have Entered is an Event"); } else { Console.WriteLine("you number have Entered is an odd"); } Console.ReadLine(); } } }
Sample Output
No comments:
Post a Comment