Computer Science, asked by renumittalia659, 1 year ago

c program that shows the binary equivalent of a given positive number between 0 to 255

Answers

Answered by PoojaBurra
20

C program finds the binary similarity of a decimal number entered by user.  

Decimal numbers are of base 10 and binary numbers are base 2.

#include <stdio.h>

 

int binary_conversion(int);

 

int main()

{

  int num, bin;

 

  printf("Enter a decimal number: ");

  scanf("%d", &num);

  bin = binary_conversion(num);

  printf("The binary equivalent of %d is %d\n", num, bin);

}

 

int binary_conversion(int num)

{

   if (num == 0)

   {

       return 0;

   }

   else

   {

       return (num % 2) + 10 * binary_conversion(num / 2);

   }

}}

Answered by rsgourav2622
0

Answer:

3245824569086322345688643

Similar questions