Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- double varrr = Divide(10, 0);
- }
- static double Divide(double a, double b)
- {
- double c = 0;
- try
- {
- c = a / b;
- return c;
- }
- catch (DivideByZeroException)
- {
- Console.WriteLine("Division by zero not allowed");
- return 0;
- }
- }
- }
- static double Divide(int a, int b)
- {
- int c = 0;
- try
- {
- c = a / b;
- return c;
- }
- catch (DivideByZeroException)
- {
- Console.WriteLine("Division by zero not allowed");
- return 0;
- }
- }
Add Comment
Please, Sign In to add comment