Safely divide 10 by 0 and print friendly message on error.
Cannot divide by zero
Toolliyo Coach
Progressive help: Nudge → Guide → Approach. Full solution stays behind the Solution tab.
Editor is open — no login wall to practice.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
class Program {
static void Main() {
int a = 10, b = 0;
try {
Console.WriteLine(a / b);
} catch (DivideByZeroException) {
Console.WriteLine("Cannot divide by zero");
}
}
}
Prefer Coach (Nudge → Guide → Approach) before revealing. No forced signup.
Catch specific exceptions first—interviewers want structured error handling, not empty catch.
Sign in to save and review your submission history. You can still Run code on the Editor tab as a guest.
Sign inInstall Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.