RosettaCodeData/Task/Detect-division-by-zero/C-sharp/detect-division-by-zero.cs

17 lines
314 B
C#
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
using System;
namespace RosettaCode {
class Program {
static void Main(string[] args) {
int x = 1;
int y = 0;
try {
int z = x / y;
} catch (DivideByZeroException e) {
Console.WriteLine(e);
}
}
}
}