Praveen | Typing Speed Test is a very useful Software available for free Download.

C Program Convert Decimal Number to Binary Number


      In This Program, Convert Decimal Number into Binary Number. Binary Number Means The Set of Digits in Form of 1 or 0 Form. All Computer System Known Only Combination of Binary Digits. Every Operation Can Perform in The System With The Help of Binary Numbers.


C programming code

#include<stdio.h>
#include<conio.h>

void main()
{
    int n, k, i, h=0, a[100];
    clrscr();
    printf("\n Enter Decimal Number ");
    scanf("%d", &n );
    while( n > 0 )
    {
         k = n % 2;
         n = n / 2;
         if( k == 0 )
             a[h] = k;
        else
             a[h]=k;
        h++;
    }
    printf("\n Binary Number-> ");
    for( i = ( h-1) ; i >= 0 ; i-- )
        printf("%d",a[i] );
    getch();
}

Output:-