What is an example of iteration in C?
a)
if-else
statementb)
for
loopc)
switch
statementd)
goto
statementAnswer:
b)
for
loopExplanation:
In C, a for
loop is a common example of iteration, where a block of code is executed repeatedly based on a condition. Iteration structures like for
, while
, and do-while
loops allow you to execute a statement or a group of statements multiple times, making them essential for tasks that require repetitive processing.
Understanding iteration is key to performing repetitive tasks efficiently in C programming.