An exercise to handle the DivideByZeroException
1
9
10
11
12
13
14
15
19
// {
public static int Calculate10DividedBy(int value)
{
return 10 / value; //if the value is 0, this will throw a DivideByZeroException, so to fix it, handle the exception and return a int.MaxValue when exception is caught
}
// {
Enter to Rename, Shift+Enter to Preview
1
using Microsoft.VisualStudio.TestTools.UnitTesting;
Enter to Rename, Shift+Enter to Preview