

InterviewSolution
Saved Bookmarks
1. |
The following function magicfun() is a part of some class. What will the function magicfun() return, when the value of n=7 and n=10, respectively? Show the dry run/working:int magicfun (int n) { if(n = = 0) return 0; else return magicfim(n/2) * 10 + (n%2); } |
Answer» At n = 7 ⇒ 111 At n = 10 ⇒ 1010 Binary equivalent of N |
|