➽ Program:-

#include<stdio.h>

int main()

{

    int number, decimal_number, rem, base = 1, binary_number = 0;

    printf("Enter a Decimal Number: ");

    scanf("%d", &number);

    decimal_number = number;

   

    while(number > 0)

    {

        rem = number % 2;

        binary_number += rem * base;

        number = number / 2;

        base = base * 10;

    }

 

    printf("Binary equivalent of %d is %d", decimal_number, binary_number);

    return 0;

}

➽ Output:-

Enter a Decimal Number: 185
Binary equivalent of 185 is 10111001