Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- var result = decimalToBinary(13);
- System.out.println(result);
- }
- public static int decimalToBinary(int n) {
- if (n == 0) {
- return 0;
- }
- return n % 2 + 10 * decimalToBinary(n / 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement