CBSE Class 11 Computer Science
Question 103 of 161
Flow of Control — Question 12
Back to all questions 12
Question Question 10a
Rewrite following code fragment 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 += iAnswer
min = 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