edited by
428 views
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)
}

 

edited by

2 Answers

0 votes
0 votes
Just 120/13=9.23 just take floor value which is 9 answer

Related questions

0 votes
0 votes
3 answers
1
nabadeep asked Apr 27, 2017
598 views
what does following code mean if j=0 and a and b are two character pointers to two strings: while(a[j]&&b[j])
3 votes
3 votes
1 answer
2
Sourabh Kumar asked Jul 20, 2016
612 views
What is the output of the following program?#include<stdio.h void main() { int n=3, i=0; do { n=n++; i++; } while(i!=3); printf(“%d\n”, n); }
1 votes
1 votes
1 answer
3
thehobo03 asked Jun 4, 2015
4,948 views
Assuming n>2 A() { while(n>1) { n = n/2; } }