Created
February 23, 2025 07:15
-
-
Save msbaek/8b21ab27e7df17fbbcd1338588af9cf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Divider { | |
public int divide(int dividend, int divisor) { | |
if (divisor != null) { | |
if(dividend != null) { | |
if (divisor != 0) { | |
return dividend / divisor; | |
} else { | |
throw new IllegalArgumentException("divisor must not be 0"); | |
} | |
} else { | |
throw new IllegalArgumentException("dividend must not be null"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment