explain different iterative statements in ' c' with syntax flow chart and example each
Answers
Answer:
correct answer
Explanation:
correct answer
In computer programming, sometimes programmer have to perform same task again and again on the same data with a few changes. In this situation programmer can either write same code again and again which consumes lots of time and space as well over can use loop to iterate same code to save time and space.
Following are the loops used in C/C++ programming
1. for loop
2. while loop
3. do-while loop
1. for loop :
A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.
Initialization : In this expression we have to initialize the loop counter to some value. for example: int i=1;
Condition: In this expression we have to test the condition. If the condition evaluates to true then we will execute the body of loop and go to update expression otherwise we will exit from the for loop. For example: i <= 10;
Increment / Decrement: After executing loop body this expression increments/decrements the loop variable by some value. for example: i++ or i--;
C++ provides four iteration statements — while, do, for, and range-based for. Example: Iteration is when the same procedure is repeated multiple times. Some examples were long division, the Fibonacci numbers, prime numbers, and the calculator game.
Iteration is the process where a set of instructions or statements is executed repeatedly for a specified number of time or until a condition is met. These statements also alter the control flow of the program and thus can also be classified as control statements in C Programming Language.
#SPJ3
Learn more about this topic on:
https://brainly.in/question/44186453