program to convert decimal number to binary number.

#include<stdio.h>
#include<coio.h>
//function definition ”binary’
void binary(int n)
{
    int r;
    r=n%2;
    n=n/2;
    if(n==0)
         printf(“%d”,r);
    else
     {
          binary(n);
          printf(“%d”,r);
     }
  }
void main()
 {
     int n;
     printf(“Enter a decimal number”);
     scanf(“%d”,&n);
     binary(n);
     getch();
  }

5 thoughts on “program to convert decimal number to binary number.

Leave a Reply

Your email address will not be published.