Question: Consider the following code: for i = 1 to n inclusive : for j = 1 to i inclusive : print EXAM end

Consider the following code:
for i =1 to n inclusive :
for j =1 to i inclusive :
print " EXAM "
end for
if i is an integer multiple of 3:
print " EXAM "
end if
end for
(a) When n=13 how many times will EXAM be printed? [2 pts]
Number of Times =
(b) For a general n how many times will EXAM be printed? [4 pts]
Number of Times =
(c) For a general n, if each print statement takes constant time, what is the \Theta runtime of [4 pts]
this code?
\Theta of ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!