> For the complete documentation index, see [llms.txt](https://andreyakinshin.gitbook.io/problembookdotnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreyakinshin.gitbook.io/problembookdotnet/en/math/overflow-p.md).

# “Overflow” (Problem)

What will the following code display?

```csharp
var maxInt32 = Int32.MaxValue;
var maxDouble = Double.MaxValue;
var maxDecimal = Decimal.MaxValue;
checked
{
  Console.Write("Checked   Int32   increased max: ");
  try { Console.WriteLine(maxInt32 + 42); }
  catch { Console.WriteLine("OverflowException"); }
  Console.Write("Checked   Double  increased max: ");
  try { Console.WriteLine(maxDouble + 42); }
  catch { Console.WriteLine("OverflowException"); }
  Console.Write("Checked   Decimal increased max: ");
  try { Console.WriteLine(maxDecimal + 42); }
  catch { Console.WriteLine("OverflowException"); }
}
unchecked
{
  Console.Write("Unchecked Int32   increased max: ");
  try { Console.WriteLine(maxInt32 + 42); }
  catch { Console.WriteLine("OverflowException"); }
  Console.Write("Unchecked Double  increased max: ");
  try { Console.WriteLine(maxDouble + 42); }
  catch { Console.WriteLine("OverflowException"); }
  Console.Write("Unchecked Decimal increased max: ");
  try { Console.WriteLine(maxDecimal + 42); }
  catch { Console.WriteLine("OverflowException"); }
}
```

[Solution](/problembookdotnet/en/math/overflow-s.md)
