Hi,
Here its a small recursive function, which will convert a decimal value to binary digits.
#include <stdio.h>
void convert_binary(int a)
{
if(a!=0)
{
convert_binary(a/2);
printf("%d",a%2);
}
else
{
return ;
}
}
int main()
{
printf("Hello world!\n");
convert_binary(130); // Here this recursive function will convert 130 to binary digits.
return 0;
}
If you feel its good, give me a thanks !!!
No comments:
Post a Comment