+ 1

Robot Barmen Help

I tried doing this problem, but i dont get any output, can someone help me finding the error, please ? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { try { int drinks = Convert.ToInt32(Console.ReadLine()); int shelves = Convert.ToInt32(Console.ReadLine()); int result = drinks / shelves; Console.WriteLine(result); } /* * 1. DivideByZeroException => "At least 1 shelf" * 2. FormatException => "Please insert an integer" */ catch (DivideByZeroException e) { Console.WriteLine("At least 1 shelf") } catch (FormatException e) { Console.WriteLine("Please insert an integer") } } } }

8th Feb 2021, 9:19 PM
Vini Souza
Vini Souza - avatar
2 Answers
+ 2
You're missing a semicolon inside both catch statements after Console.WriteLine(...).
8th Feb 2021, 9:36 PM
♡Addy♡
♡Addy♡ - avatar
0
Thanks a lot
8th Feb 2021, 9:46 PM
Vini Souza
Vini Souza - avatar