Write C# Program to Find the Largest Number Among Three Number


Introduction

Write C# Program to Find the Largest Number Among Three Number. 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. namespace csharpprograms
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int num1, num2, num3;
  10.  
  11. Console.Write("Input the 1st number :");
  12. num1 = Convert.ToInt32(Console.ReadLine());
  13. Console.Write("Input the 2nd number :");
  14. num2 = Convert.ToInt32(Console.ReadLine());
  15. Console.Write("Input the 3rd number :");
  16. num3 = Convert.ToInt32(Console.ReadLine());
  17.  
  18. if (num1 > num2)
  19. {
  20. if (num1 > num3)
  21. {
  22. Console.Write("The 1st Number is the greatest among three. \n\n");
  23. }
  24. else
  25. {
  26. Console.Write("The 3rd Number is the greatest among three. \n\n");
  27. }
  28. }
  29. else if (num2 > num3)
  30. Console.Write("The 2nd Number is the greatest among three \n\n");
  31. else
  32. Console.Write("The 3rd Number is the greatest among three \n\n");
  33.  
  34. Console.ReadLine();
  35.  
  36. }
  37. }
  38. }
  39.  

Result

C# language techstudy.org

     





Related Topics




Popular Posts