#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void convert_to_binary(int n, char *output){
        if(n == 0)
                return;
        convert_to_binary(n / 2, output);
        int index = strlen(output); 
        output[index] = n % 2 + '0';
}

int main(void) {
    int n = 1205;
    int num_bits = 32;  
    char *output = malloc(num_bits * sizeof(char)); 
    convert_to_binary(n , output);
    printf("%s\n",output);
    
    free(output);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: