Loop

https://drive.google.com/file/d/1U9sYX33X1tzGqnRMbrnUuXQB8uJjbJlk/view?usp=sharing

https://drive.google.com/file/d/1f1UYWItGjVoDHo9WeLqDm7nRWLRlVePB/view?usp=sharing

https://drive.google.com/file/d/1AwqJEzzMaoQL_F9ufOQExdYWtukgc430/view?usp=sharing

 PST-pdf                    Instagram                              Twitter                        YouTube

{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{

}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

--------------------------------------------------------------------------------------------------------------------

1. INTRODUCTION  PST-PDF

-------------------------------------------------------------------------------------------------------------------

2. OPERATORS   PST-pdf

-------------------------------------------------------------------------------------------------------------------

3. LOOPING

-------------------------------------------------------------------------------------------------------------------
3.1 While Loop
while loop can be addressed as an entry control loop. It is completed in 3 steps.

➊ Variable initialization.
➋ Condition
➌ Variable increment or decrement

Syntax: 
variable initialization;
while(condition)
{
statements;
variable increment or decrement;
}

Why While Loops?
✔ Like all loops, while loops execute blocks of code over and over again.
✔ The advantage to a while loop is that it will go (repeat) as often as necessary to accomplish its goal.
✔ Loop is executed only when condition is true.

For Programming Training:
DM me Instagram
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
3.2 Do while Loop

Do While
✔ In some situations it is necessary to execute body of the loop before testing the condition.
✔ Such situations can be handled with the help of do-while loop.
✔ do statement evaluates the body of the loop first and at the end, the condition is checked using while statement.
✔ It means that the body of the loop will be executed at least once, even though the starting condition inside while is initialized to be false.

Syntax:
do
{
.....
.....
}while(condition);


For Programming Training:
DM me Instagram
-----------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
3.3 for Loop 
for loop is used to execute a set of statements repeatedly until a particular condition is satisfied. We can say it is an open ended loop.. General format is,

for(initialization; condition; increment/decrement)
{
statement-block;
}

In for loop we have exactly two semicolons, one after initialization and second after the condition. In this loop we can have more than one initialization or increment/decrement, separated using comma operator. But it can have only one condition.

Points to Remember:
✔ It first evaluates the initialization code.
✔ Then it checks the condition expression.
✔ If it is true, it executes the for-loop body.
✔ Then it evaluate the increment/decrement condition and again follows from step 2.
✔ When the condition expression becomes false, it exits the loop.


For Programming Training:
DM me Instagram
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BCA                                        PST & Programming C                                   Allrounder Sita Ram Sahu
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
>

No comments:

Post a Comment