B. When is the break statement used?
C. When is the continue statement used?
D. Convert the following for loop into while loop.
for i in range(50,0,-2):
print(i,end=’ ‘)
E. Answer the following questions.
a. How many times will the following loop execute and what will be its output for both the programs,
a and b?
sum=0
for i in range(20,0,-2):
sum=sum+i
print(i)
if i==14:
continue
print (sum)
(a)
break
print(sum)
(b)
F. Convert the following while loop into for loop
i=0
s=0
while i
if i%7==0:
s = s+i
i = i+7
print(s)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here