Write a program in C# that checks whether the two numbers entered by the user are equal or not.
Following is the simple C# code :
Following is the simple C# code :
class Lab { static void Main(string[] args) { int? firstValue; int? secondValue; Console.WriteLine("Enter First Number"); firstValue = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter Second Number"); secondValue = Convert.ToInt32(Console.ReadLine()); if (firstValue == secondValue) { Console.WriteLine("First Number = {0} and Second Number = {1} both are equal", firstValue, secondValue); } else { Console.WriteLine("First Number = {0} and Second Number = {1} both are not equal", firstValue, secondValue); } Console.ReadLine(); } }
Output:-
No comments:
Post a Comment