7. Ram learnt that the elements in while loop control and govern its execution. In the following program, help him to
find out the elements.
1.num=int( input("Enter a number:"))
2. fact=1
3. a=1
4. while a<=num:
5. fact*=a
6. at=1
7.print("The factorial of", num, "is”, fact)
a. Identify the While loop element in line 3.
b. Name the element in line 4.
c.Which line represents the body of the loop?
d. Which line of code changes the value of a loop variable?
Answers
Answered by
1
Answer:
a) declaration of value for condition of loop
b) loop statement (loop condition)
c) line 5
d) line 3 and line 1
Similar questions