Online Compiler C

#include <stdio.h> void convert(int n, int p) { if (n >= 0) { convert(n / p, p); printf("%d", n % p); } } int main(void) { int n, p; scanf("%d %d", &n, &p); convert(n, p); printf("\n"); return 0; }
1) This code reads two integers `n` and `p`, then calls a recursive function `convert` to print the representation of `n` in base `p`.

2) Hint: The function `convert` currently only works for non-negative `n`. Think about what happens if `n` is negative.  
Hint: The base `p` should be greater than 1 for meaningful conversion — consider what might happen if `p` is 0, 1, or negative.