Computer Science
Rewrite the following code fragment using for loop:
while num > 0 :
count += 1
sum += num
num –= 2
if count == 10 :
print (sum/float(count))
break
Related Questions
Rewrite the following code fragment using for loop:
i = 100 while (i > 0) : print (i) i -= 3Rewrite the following code fragment using for loop:
while num > 0 : print (num % 10) num = num/10Rewrite 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 += iRewrite following code fragment using while loops :
for i in range(1, 16) : if i % 3 == 0 : print (i)