Please read up on "checked and unchecked operators and statement keywords in C#"
Statement Keywords http://msdn.microsoft.com/en-us/library/xt4z8b0f.aspx The checked and unchecked operators http://msdn.microsoft.com/en-us/library/aa691349(VS.71).aspx http://www.codeproject.com/KB/cs/overflow_checking.aspx On Wed, Aug 12, 2009 at 8:26 PM, thread <[email protected]> wrote: > > if for example i will do > delta = b*b - 4*a*c > Math.Sqrt(delta) > if the delta will be minus i will get garbage as a result instead of > worning massage > > On 11 אוגוסט, 07:12, Yashika <[email protected]> wrote: > > u r creating class object in same class.see the code and run it > > > > namespace ConsoleApplication1 > > > > { > > > > public class MyClass > > > > { > > > > public void divide() > > > > { > > > > int x = 0; > > > > int result = 0; > > > > try > > > > { > > > > result = 5 / x; > > > > } > > > > catch (DivideByZeroException de) > > > > { > > > > Console.WriteLine(de.Message); > > > > } > > > > Console.WriteLine("Result {0}", result); > > > > } > > } > > > > class Program > > > > { > > > > static void Main(string[] args) > > > > { > > > > MyClass m = new MyClass(); > > > > m.divide(); > > > > } > > } > > } > > > > i hope this will help u > > > > On 8/11/09, Raghupathi Kamuni <[email protected]> wrote: > > > > > > > > > > > > > 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.. > .. > > > > > 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?-הסתר טקסט מצוטט- > > > > -הראה טקסט מצוטט- >
