For Loop in C
For Loop Definition
For loop in C is defined as control structure, which allows to execute the block of codes for specific number of times until the condition is false. For loop is also known as entry-controlled loop.
Working of for Loop :
The for loop follows a very organized methodology in which it first initializes a condition, then tests the condition, and then performs conditional statements before updating data.
It has 3 parameters : Initialization, test expression and updation.
The conditional variable that iterates the value or aids in checking the condition is accepted as the first parameter of a basic for loop, which accepts it.
Test Expression :
The Second parameter of a fundamental for loop defines the expression , if the check expression is true, the loop iterates further; otherwise, it stops and move out of the loop.
A basic for loop’s third parameter specifies whether to increment or decrement the conditional variable that iterates the code in response to the condition.
Body of for loop :
Body is known as a group of statements, such as variables, functions, etc.
When an iteration is successful, these are automatically carried out, and they continue to do so until the condition is not met.
PrepInsta PrepInsta PrepInsta PrepInsta PrepInsta PrepInsta
In the above example, the value of i initialize at 0 and for every increment till the condition (i<=5) PrepInsta will be print.
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others