# C program to Convert Decimal To Binary

Decimal to Binary Converter in C using inbuilt function itoa

```/**********************************************************************
Decimal to binary in c
**********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main(int argc, char** argv) {
int number;
char binary [10];
printf("Enter a decimal number:");
scanf("%d",&number);
printf("\n");
itoa(number, binary, 2);
printf("\nBinary conversion of %d : %s", number, binary);
getch();

return 0;
}

/*
OUTPUT:
Enter a decimal number:7
Binary conversion of 7 : 111
*/

```

Decimal to Binary Converter in C

```/**********************************************************************
Decimal to binary in c
**********************************************************************/
#include<stdio.h>

int main(){

long int decimalNumber, quotient;

int binaryNumber[100],i=1,j;

printf("Enter a decimal number: ");

scanf("%ld",&decimalNumber);

quotient = decimalNumber;

while(quotient!=0){

binaryNumber[i++]= quotient % 2;

quotient = quotient / 2;

}

printf("Binary conversion of %d : ",decimalNumber);

for(j = i -1 ;j> 0;j--)

printf("%d",binaryNumber[j]);

return 0;

}

/*
OUTPUT:
Enter a decimal number:7
Binary conversion of 7 : 111
*/

```