3rd Assignment by Obedience Laraib Rodeni
3rd Assignment by Obedience Laraib Rodeni
University Of Karachi
Submitted to
Madam Munazza Yousuf
By
Laraib Rodeni
Seat No. B23161006047
Assignment: Iteration and For Loop in C Language
Q1: What is Iteration in C Language?
In C programing language iteration can be defined as repeating the same
Process multiple
Times until a specific condition satisfies. Simply we can say that it is the
Process of repeatedly
Executing a block of code . The term looping is also used for iteration. Further
The concept of
Iteration is that it allows you to automate repetitive tasks , Making your code
Concise. Instead of writing the same lines of code multiple times, you can use
A loop (iteration)
1_for loop
2_While loop
Powerful tool to
Handle it effectively. When you need to perform a task multiple times, whether
It’s iterating
C offers a
In one place, it
Simplifies repetitive operations. In this post, we’ll explore everything about the
How it works, its syntax, real-life applications, and examples to help you
Master it.
Like other loops, for loop in C programming runs a block of code several times
Until a condition
Parts: initialization(
1. Initialization:
This step initializes the loop control variable (e.g., int I = 0). It runs only once,
int main() {
scanf("%d", &n);
scanf("%lf", &trade_value);
average = sum / n;
return 0;
Output results:
Visual output: