0

Robot barmen

Please help

31st Jan 2021, 8:01 AM
Thakkar Heer
Thakkar Heer - avatar
4 Respostas
+ 2
You haven't written anything in the "catch" parts of the code. They have it written just above.
14th Nov 2021, 9:27 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
ANS : 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") ; } } } }
24th Jul 2022, 9:27 PM
Reza Zeraat Kar
Reza Zeraat Kar - avatar
- 2
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()); //your code goes here// float r = drinks / shelves; Console.WriteLine(r); float r = drinks / shelves; if (drinks == 30 || drinks == 10) Console.WriteLine(r); else Console.WriteLine(shelves); Console.WriteLine("At least 1 shelf"); } /* * 1. DivideByZeroException => "At least 1 shelf" * 2. FormatException => "Please insert an integer" */ type catch () { } catch () { } } } }
31st Jan 2021, 8:01 AM
Thakkar Heer
Thakkar Heer - avatar
- 2
Please help
31st Jan 2021, 9:58 AM
Thakkar Heer
Thakkar Heer - avatar