#include<stdio.h>
#include<conio.h>
int f(int n,int k)
{
if (n==0)
return 0;
else
 if(n%2)
 return f(n/2,2*k)+k;
 else return f(n/2,2*k)-k;
}
int main()
{
clrscr();
printf("\n %d",f(20,1));
getch();
}

O/p is 9.....Plz explai me how it is come........


Vijay.........

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to