The output is 10101101
consider it to be f(173) -> f(86) -> f(43) -> f(21) -> f(10) -> f(5) -> f(2)
-> f(1)
1 0 1 1 0
1 0 1
Hope you get the recursion there .
On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar <[email protected]>wrote:
> #include<stdio.h>
> #include<conio.h>
> int f(int n)
> {
> if(n<=1)
> {
> printf(" %d",n);
> }
> else
> {
> f(n/2);
> printf(" %d",n%2);
> }
> }
>
> void main()
> {
> clrscr();
> f(173);
> getch();
> }
>
> o/p-1 0 1 0 1 1 0 1
> but i m getting 1 0 1 1 0 1 0 1
>
> plz explain me...........
>
> --
> 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.
>
>
--
Regards
Rajeev N B <http://www.opensourcemania.co.cc>
"*Winners Don't do Different things , they do things Differently"*
--
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.