#C14786. Divide Two Numbers with Error Handling
Divide Two Numbers with Error Handling
Divide Two Numbers with Error Handling
You are given two inputs representing numbers, which may be integers or floating-point values. Your task is to compute the division \(\frac{x}{y}\) and handle error cases properly. Specifically, if the divisor \(y\) is zero, output the error message "Cannot divide by zero". If either of the inputs is not a valid number, output "Both arguments must be numbers".
The solution should read the input from standard input (stdin) and write the output to standard output (stdout). Use exception handling (or equivalent error checking) in your implementation to manage potential errors.
inputFormat
The input consists of a single line with two tokens separated by whitespace. The tokens represent the dividend \(x\) and the divisor \(y\). They may be valid numbers or strings.
Examples:
10 2 10 0 10 a
outputFormat
If the division is valid, output the result of \(x/y\). Otherwise, output the appropriate error message as a string: either "Cannot divide by zero" or "Both arguments must be numbers".
## sample10 2
5