Friday, 23 September 2016

Binary by recursion

/* Binary by recursion */

#include<stdio.h>
void binary(long);
int main()
{
long n;
printf("Type a value : ");
scanf("%ld",&n);
binary(n);
return 0;
}

void binary(long n)
{
if(n>1)
binary(n/2);
printf("%ld",n%2);
}

No comments:

Post a Comment

Featured post

Will AI Replace Programmers? The Truth Behind the Hype in 2025

Exploring the Future of Coding: Will AI Take Over Software Development or Enhance It?  Will AI Replace Programmers? The Truth Behind the Hyp...