निम्नलिखित कोड से कितने नंबर प्रिंट होंगे?
How many numbers will be printed by the following code ?
def fun(a,b):
for x in range(a,b+1):
if x%3==0:
print(x, end=" ")
fun(100,120)
A)
B)
C)
D)
Explanation:
The code checks for numbers divisible by 3 between 100 and 120. The numbers divisible by 3 in this range are:
102, 105, 108, 111, 114, 117, 120.
There are 7 such numbers, so the output will print 7 numbers.
Answer: (A) 7