DividedByZeroException
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 llençar una excepció del tupus DividedByZeroException
(aquesta excepció l'hauràs de crear tu).
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 es produirà una excepció del tipus DividedByZeroException
.
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
Exception in thread "main" DividedByZeroException
at dividedbyzeroexcept.main(dividedbyzeroexcept.java:18)
CC BY-NC-SA 4.0