Oindrila C Project
Oindrila C Project
We would like to express our sincere gratitude to the following individuals and organizations for their
invaluable contributions to this report:
* Pallab Sen for their guidance and support throughout the research process.
* EIILM KOLKATA for their specific contributions to the report. We would also like to thank our peers
and classmates for their insightful feedback and collaborative spirit.
Flowchart of a For Loop in C
Explanation:
1. Initialization:
2. Condition Check:
3. Body Execution:
* If the condition is true, the statements within the loop body are executed.
4. Update:
6. Termination:
Example:
In this example:
Key Points:
* The for loop is a versatile control flow statement that allows you to execute a block of code
repeatedly.
* It's often used for iterating over arrays, processing lists, and performing repetitive tasks.
* The three components of a for loop (initialization, condition, and update) provide a concise and
efficient way to control the loop's behavior.
By understanding the flowchart and the example, we can effectively use for loops in your C programs
to write efficient and well-structured code.
Types of Loops in C:
* For Loop:
* While Loop:
* Do-While Loop:
* Executes at least once, and then continues as long as a given condition remains true.
#include <stdio.h>
int main() {
int i;
printf("\n");
return 0;
#include <stdio.h>
int main() {
int i = 1;
i++;
printf("\n");
return 0;
#include <stdio.h>
int main() {
int i = 1;
do {
i++;
printf("\n");
return 0;
}
Conclusion:
By understanding the flowcharts and syntax of these loops, programmers can effectively control the
flow of their programs and write efficient code. The choice of loop depends on the specific
requirements of the task, such as the number of iterations and the desired behaviour.