CBSE Class 10 Computer Applications
Question 17 of 26
Python Conditionals and Loops — Question 8
Back to all questions 8
Question Question 7(a)
Rewrite following code fragments using while loops
min = 0
max = num
if num < 0 :
min = num
max = 0
# compute sum of integers from min to max
for i in range(min, max + 1):
sum += imin = 0
max = num
if num < 0 :
min = num
max = 0
# compute sum of integers from min to max
i = min
while i <= max:
sum += i
i += 1