1 votes 1 votes How many times does the while loop gets executed if the following function is called as $f(120,13)?$ f(m,n) { ans := 1 while (m - n >= 0) { ans := ans * 2 m := m - n } return(ans) } Nulu Madhu asked Dec 14, 2018 • edited Dec 14, 2018 by Lakshman Bhaiya Nulu Madhu 438 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Lakshman Bhaiya commented Dec 14, 2018 reply Follow Share ans$=512$ and while loop executed $9$ times 1 votes 1 votes Nulu Madhu commented Dec 14, 2018 reply Follow Share Please explain 0 votes 0 votes Lakshman Bhaiya commented Dec 14, 2018 i edited by Lakshman Bhaiya Dec 14, 2018 reply Follow Share ok please, you can also try to trace out. check the answer 0 votes 0 votes Please log in or register to add a comment.
Best answer 1 votes 1 votes Making a tree diagram is easy to understand. Lakshman Bhaiya answered Dec 14, 2018 • edited Jan 8, 2019 by Lakshman Bhaiya Lakshman Bhaiya comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Just 120/13=9.23 just take floor value which is 9 answer Yash4444 answered Jan 18, 2020 Yash4444 comment Share Follow See all 0 reply Please log in or register to add a comment.