Q. Rewrite following code fragments using while loops:
(a)
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 += i
(b)
for i in range(1, 16) :
if i % 3 == 0 :
print (i)
(c)
for i in range(4) :
for j in range(5) :
if i +1 == j or j + i == 4 :
print ("+", end = " ")
else :
print ("o", end = " ")
print ()
Answer =
#(a)
min = 0
max = num
if num < 0 :
min = num
max = 0 # compute sum of integers from min to max
i = min
while i < max + 1 :
sum += i
i += 1
#(b)
i = 1
while i < 16 :
if i % 3 == 0 :
print (i)
i += 1
#(c)
i = 0
j = 0
while i < 4 :
j = 0
while j < 5 :
if i + 1 == j or j + i == 4 :
print("+",end=" ")
j += 1
else :
print("o",end = " " )
i += 1
print()
Please sent answer of this question
ReplyDeleteOk , I will upload it very soon...
DeleteYes please upload answer of this question fast please!!!
ReplyDeleteOk .
DeleteNOT UPLOADED THE ANSWER?????
ReplyDeleteI have done it
Deleteplease explain me it deeply
ReplyDeleteWhich part.
Deleteplease explain me in deeply
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )