126
1
using System;
2
using static System.Console;
3
var m = int.MaxValue;
4
// possible solutions:
5
try
6
{
7
WriteLine("n is an IntPtr");
8
var n = IntPtr.MaxValue;
9
checked
10
{
11
var y = n + 5;
12
WriteLine(y);
13
var x = m + 5;
14
WriteLine(x);
15
throw new Exception("Should not get here.");
16
}
17
}
18
catch (OverflowException) { }
19
20
try
21
{
22
WriteLine("n is a float");
23
var n = float.MaxValue;
24
checked
Cached Result