CBSE BOARD XII, asked by ARINDOMDEBBARMA, 11 months ago

Explain the While...EndWhile loop with an example.​

Answers

Answered by sudarshanraj50
0

Answer:

the while is discovered by early man and he loop in the early man was not happy and constrated to any thing that's why

Explanation:

it

Answered by CutieLucy66
1

Answer:

In a 'While loop' , the snippet entered below the 'while loop' header (Condition), will be executed only until the entered boolean condition at the end of the block is evaluated as 'True' ,if not then the block of code intended below the condition won't be executed

Example:

apple=5

orange=7

sum=apple+orange

while sum>=10:

    print("Price has increased")

    orange=orange-2

print("Done")

The above code will execute as follows:

output:

Price has increased

Price has increased

Done

Explanation:

because initially sum=12

the boolean evaluates to true and executed the following 2 lines of code,and reduces '2' from orange where it results as

sum=10

when the loop iterates again the boolean evaluates to true and executes the following 2 lines again and reduces '2' from orange again and it results in

sum=8

which is less than 10,so the boolean evaluates to false and the loop will break and wont iterate again.Then it prints the following code as usual

HOPE YOU FIND THIS ANSWER HELPFUL!!!

Similar questions