Consider the following output?
a=int(input("Enter any Number:"))
for b in range(5,8):
c=a+b
print(c)
What is the output when the input value is 6?
Answers
Answered by
2
Output:-
10
11
12
Explanation:-
Given original value of a is 6
b loop will work from 5 to 7
- When b is 5.....c=a+b=5+5=10...so control will print 10 and goes to next line then b gets updated with +1
- When b is 6...c=5+6=11....so the control will print 11 and goes to next line then b gets updated with +1
- When b is 7...c=5+7=12 so the control will print 12 and goes to next line then b gets updated with +1
- When b is 8....loop terminates
Similar questions