using System;
public class MyClass
{
void divide()
{
int x = 0;
int result =0;
try
{
result = 5/x;
}
catch(DivideByZeroException de)
{
Console.WriteLine(de.Message);
}
Console.WriteLine("Result {0}",result);
}
public static void Main()
{
MyClass m = new MyClass();
m.divide();
}
}
DivideByZeroException Class
http://msdn.microsoft.com/en-us/library/system.dividebyzeroexception.aspx
On Mon, Aug 10, 2009 at 10:14 PM, thread <[email protected]> wrote:
>
> Hi all,
>
> i dont know if this problem is common for cerain calcualtion or maybe
> something was incorrect with the apperoach but when i calculate for
> example 5/0
> i'm getting some garbage instead of a warning about the zero devision
> what am i doing wrong
> any idea?
>