PFund Lab 6
PFund Lab 6
Objective:
Implementation Of for And Nested for Loops:
Example #1
Example #2
Example #3
Example #4
Lab Task
Task #1
Task #2
Task #3
Task #4
Write a program to generate a series of first 50 even numbers.
Task #5
Write a program that generates a table of any number.
Task #6
Write a program to calculate the factorial of any number.
SUMMARY:
for loop: Ideal for iterating a fixed number of times. It’s simple, readable,
and efficient for many tasks where the number of iterations is known in
advance.
Nested for loop: A powerful tool when you need to perform multiple
iterations for each step of an outer loop, such as when working with multi-
dimensional arrays or generating complex patterns. However, be cautious
with performance, especially with large inputs, since the time complexity
increases exponentially with each additional nested loop.