Не могу вывести исключение с try и catch - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace truecatch
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Введите первое число");
int a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите второе число");
int b = Convert.ToInt32(Console.ReadLine());
int c;
c = a / b;
try
{
Console.WriteLine(c);
}
catch (DivideByZeroException)
{
Console.WriteLine("На 0 делить нельзя");
}
catch(FormatException)
{
Console.WriteLine("Некорректный формат ввода");
}
Console.WriteLine("EXIT");
Console.ReadLine();
}
}
}Решение задачи: «Не могу вывести исключение с try и catch»
textual
Листинг программы
try {
//ToDo
}
catch (DivideByZeroException e) {
Conssole.WriteLine(e.Messege);
//ToDo
}