Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let dec = process.argv[2];
- let result = '';
- const getChar = char =>
- ({
- '10': 'A',
- '11': 'B',
- '12': 'C',
- '13': 'D',
- '14': 'E',
- '15': 'F'
- }[char] || char);
- do {
- const float = dec / 16;
- const int = (dec = Math.floor(float));
- const remainder = (float - int) * 16;
- result = getChar(remainder) + result;
- } while (dec !== 0);
- console.log(result);
Add Comment
Please, Sign In to add comment