Why does division of 0 crash your program and C#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why does division of 0 crash your program and C#?

The title says it all.

26th Feb 2018, 4:36 AM
Neeron Bhatta
Neeron Bhatta - avatar
3 Answers
+ 5
because zero shows the absence of value and dividing by nothing is like infinity
26th Feb 2018, 5:03 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 18
bcz it is undefined
26th Feb 2018, 5:04 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
Use exception handling, like this: catch (DivideByZeroException e) { Console.WriteLine("Cannot divide by 0"); https://www.sololearn.com/learn/CSharp/2690/
26th Feb 2018, 5:01 AM
Paul
Paul - avatar