Convert Decimal to Binary number system with C.

/*
Input

Input decimal number: 112
Output

Binary number: 0111000

*/

#include <stdio.h>

int main()
{
    long long decimal, tempDecimal, binary;
    int rem, place = 1;

    binary = 0;
    printf("Enter any decimal number: ");
    scanf("%lld", &decimal);
    tempDecimal = decimal;

    /* Decimal to binary conversion */
    while (tempDecimal > 0)
    {
        rem = tempDecimal % 2;
        binary = (rem * place) + binary;
        tempDecimal /= 2;
        place *= 10;
    }

    printf("Decimal number = %lld\n", decimal);
    printf("Binary number = %lld", binary);

    return 0;
}

Output:-

Enter any decimal number : 45
Decimal number = 45
Binary number = 101101