Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int tohex(int x, int p) {
- if (x == 0) {
- return 0;
- }
- int dig = x % 10;
- return tohex(x / 10, 16 * p) + dig * p;
- }
- int main() {
- printf("%d\n", tohex(312, 1));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement