Code for Function to find the binary equivalent of a given decimal integer and display it in C Programming
# include<stdio.h>
void main()
{
int n;
void binary(int); // Function Declaration
clrscr();
printf("Enter any Decimal Number : ");
scanf("%d",&n);
binary(n); // Function Calling
getch();
}
void binary(int x) // Function Definition.
{
char s[20];
int i,t;
t=x;
i=0;
while(t>0)
{
s[i]=t%2;
t=t/2;
i++;
}
s[i]='\0';
printf("Binary Equivalent of %d = ",x);
for(i=i-1;i>=0;i--)
printf("%d",s[i]);
}