C Program to Convert Decimal Number to Binary

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{ 
int n, q, rem, i, bin, rev, flag=0,k=0;
clrscr();
printf("Enter the decimal number :");
scanf("%d",&n);
q=n;
rev=0;
while(q>0) 
{
rem=q%2;
if(rem==0 && flag==0)
k++;
else
flag=1;
rev=(rev*10)+rem;
q=q/2;
}
q=rev;
bin=0;
while(q>0) 
{
rem=q%10;
bin=(bin*10)+rem;
q=q/10;
if(q==0)
{
for(i=1;i<=k;i++)
bin=bin*10;
}
printf("The binary number is %d",bin);
getch();
}

Output:
Enter the decimal number: 25
The binary number is 11001