Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class IntegerSquareRoot
- {
- static void Main()
- {
- string input = Console.ReadLine();
- try
- {
- int num = int.Parse(input);
- Console.WriteLine(Math.Sqrt(num));
- }
- catch (FormatException)
- {
- Console.WriteLine("Invalid number.");
- }
- catch (ArgumentException)
- {
- Console.WriteLine("Invalid number.");
- }
- catch (OverflowException)
- {
- Console.WriteLine("Invalid number.");
- }
- finally
- {
- Console.WriteLine("Good bye.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement