3 3 votes What is the function of x and n computed by the below code segment int myprog(int x,int n) { int val=1; if(n>0){ if((n%2)==1) val=val*x; val=val*myprog(x*x,n/2); } return val; } 1) xpow n 2) x*n 3) xpow(n/2) 4) x root n Programming in C programming-in-c + – srestha 730 views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply joshi_nitish commented Nov 3, 2017 reply Follow flag function is calculating, x pow n.........option 1) is correct. 0 0 replyShare srestha commented Nov 3, 2017 reply Follow flag which procedure u solved it? 0 0 replyShare joshi_nitish commented Nov 3, 2017 reply Follow flag recursion tree method, and taking some random value for x and n.... 1 1 replyShare saipriyab commented Nov 5, 2017 reply Follow flag I took random values of x=2 and n=4 Then we will get val=val*myprog(4,2) var=var*myprog(16,1) var=var*16 so when evaluating value of var will always be 1??? from bottom to top 0 0 replyShare Please log in or register to add a comment.