11567 - Hexadecimal to Binary
raw download clone
C
views 23
,
size 334 b
#include <stdio.h>

int main(void)
{
    int a, b, x, i = -1;
    int ans[100000];

    scanf("%x", &a);
    scanf("%x", &b);
    x = a + b;
    while(x != 0)
    {
        i++;
        ans[i] = x % 2;
        x /= 2;
    }
    for(int j=i; j>=0; j--)
    {
        printf("%d", ans[j]);
    }

    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.