Predict the output of the following code?

for i in range(6):

for j in range (5):

If (i + 1==j or j+i== 4):

print(“+”, end="")

else:

print (“0”, end="")

print()

 

Answer:

[Class 11] Predict the output of the following code - Flow of Control - Short Answer Type Questions (2/3 Marks each)

Output:

0+00+

00++0

00++0

0+00+

+0000

00000

Remove Ads Share on WhatsApp
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo