The command const int limit =4; on line 3 sets limit to 4 Then the command points = 100 +random(limit); on line 8 sets variable "points" to a number 100 + someinteger number from the interval [0,4), where 4 is not included. Thus the variable "points" takes one of values:100,101,102,103.Further in the loop for(int p =points ; p>= 0 ;p--) in the line 9 the variable "p" will be decreasefrom points to 0 with step 1. The body of the loop consists of a unique line 10: cout<<p<<" "; which prints p.
Hence the reare only 4 possible outputs of the program:
100 99 98 ... 0 101 100 99 98... 0 102 101 100 99 98 ... 0 103 102 101 100 99 98 ... 0 Hence possible output is only a): a)103 102 101100 Since in b)100 101 102103 c)100 101 102103 104 the numbers increase,
and in d)104 103 102101 100 the sequence starts from 104 Thus the answer is a)
Comments
Leave a comment