Thursday, August 18, 2011

Decimal to binary conversion program

#include "stdio.h"


#include "conio.h"

void main()

{

int num[10];

int i=0,digit;

int n;

clrscr();

printf("enter a decimal number\n");

scanf("%d",&n);

while(n!=0)

{

digit=n%2;

num[i]=digit;

i++;

n=n/2;

}

i--;

printf("binary form: ");

while(i>=0)

{

printf("%d",num[i]);

i--;

}

getch();

}

OUTPUT : -
enter a number in decimal form
10
binary form: 1010


r u unable to understand this program??????????TRY THESE




1. Email us at chelperr@gmail.com

2. Post your question in the comment box.

3. You can give us your email ID also.
4.  If you want to ask a program/topic or wanted introduce any discussion topic then  just email at chelperr@gmail.com or drop a comment in the comment box.

No comments:

Post a Comment