Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

PROGRAM OF DECIMAL TO BINARY CONVERSION

Posted By: Adalric Fischer     Category: C Programming     Views: 16222

WRITE A PROGRAM OF DECIMAL TO BINARY CONVERSION.

Code for PROGRAM OF DECIMAL TO BINARY CONVERSION in C Programming

#include<stdio.h>
#include<conio.h>
int i=0,bin[100];
void main()
{
    int j=0;
    int read(),destobin();
    clrscr();
    j=read();
    destobin(j);
    getch();
}

int read()
{
    int num;
    printf("\n PLEASE ENTER THE VALUE IN DECIMAL ( 0 - 9 ): ");
    scanf("%d",&num);
    return(num);
}

int destobin(int j)
{
    for(i=0;j>0;i++)
    {
        bin[i]=j%2;
        j=j/2;
    }
    i--;
    printf("\nDECIMAL TO BINARY CONVERSION IS \t");
    for(i;i>=j;i--)
        printf("%d",bin[i]);
}
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM OF DECIMAL TO BINARY CONVERSION Or get search suggestion and latest updates.

Adalric Fischer
Adalric Fischer author of PROGRAM OF DECIMAL TO BINARY CONVERSION is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!