ArithmeticException


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
C#, Go, Java, Python

Escriu un programa que, donat nombre enter \(E\), mostri per pantalla el resultat de l'operació \(10 / E\).

Has de tenir en compte que, si \(E=0\), cal mostrar per pantalla el text No es pot dividir entre zero!.

Nota: la idea és resoldre l'exercici fent servir tractament d'excepcions, i no pas condicionals.

Input Format

Primera línia:

  • \(E\): un nombre enter.

Constraints

N/A

Output Format

S'imprimirà un nombre enter, resultat de dividir \(10\) entre \(E\), o el text No es pot dividir entre zero!.

Test Case 1

Input
10
Output
1

Test Case 2

Input
-10
Output
-1

Test Case 3

Input
5
Output
2

Test Case 4

Input
0
Output
No es pot dividir entre zero!

Authorship: Fernando Porrino Serrano

CC BY-NC-SA 4.0