158k views
4 votes
For the R function shown below(Attachment):

What is returned from the function, in terms of j?

For the R function shown below(Attachment): What is returned from the function, in-example-1

1 Answer

2 votes

Answer:

The given function will return an integer in term of j on each iteration of while loop. However, it is noted that this program has some syntax error. The complete code executed in an online R compiler with explanation is given below

Step-by-step explanation:

def<-function(j){

k=0;

i=1;

while (i<j**3) #j raise to power 3

{

k<-k+1;#k=k+1

i <- i*2;#i=i*2

print(k);#

}

}

def(6)# if you pass the value 6 to function def(j)

For the R function shown below(Attachment): What is returned from the function, in-example-1
User Atom Store
by
4.0k points