c#
C#
3
Posts
3
Posters
0
Views
1
Watching
-
wap to divide a number by another no. and handle all possible exception plz help me
-
wap to divide a number by another no. and handle all possible exception plz help me
Not very clear. Anyway assuming you have `int`s, there are two bad cases: 1) anything divided by zero. 2) int.MinValue / -1 Just test both. if (y == 0 || y == -1 && x == int.MinValue) { // do whatever you have to do but don't divide x by y } else { int d = x / y; // this is safe now }
-
wap to divide a number by another no. and handle all possible exception plz help me
Hmmm.... Can you be a little more vague?