Write C# Program to accept two integers and check whether they are equal or not

Write C# Program to accept two integers and check whether they are equal or not


Introduction

Write C# Program to accept two integers and check whether they are equal or not. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2.  
  3. public class charpexercise
  4. {
  5. static void Main(string[] args)
  6. {
  7.  
  8. int num1, num2;
  9.  
  10. Console.WriteLine("Input the values for Number1 and Number2 : ");
  11. num1 = Convert.ToInt32(Console.ReadLine());
  12. num2 = Convert.ToInt32(Console.ReadLine());
  13.  
  14. if (num1 == num2)
  15. {
  16. Console.WriteLine("Number1 and Number2 are equal\n");
  17. }
  18.  
  19. else
  20. {
  21. Console.WriteLine("Number1 and Number2 are not equal\n");
  22. }
  23.  
  24. Console.ReadLine();
  25. }
  26. }

Result

C# language techstudy.org

     





Related Topics




Popular Posts