i wrote a program to determine the binary digits of the entered integer. I want to implement it in other programs directly, instead of typing the same code again n again. Does anyone know? how to do that?????????
#include<conio.h>
#include<stdio.h>
int main()
{
int n,a[20],i=0;
printf("Enter a number: ");
scanf("%d",&n);
while(n!=0)
{
while(i<16)
{
a[i]= n%2;
n=n/2;
i++;
break;
}
}
for(i=i-1;i>=0;i--)
{
printf("%d",a[i]);
}
return 0;
}