0% found this document useful (0 votes)
6 views4 pages

Nested Loops in C Programming Guide

Uploaded by

wohan03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Nested Loops in C Programming Guide

Uploaded by

wohan03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🎥 NESTED LOOPS TUTORIAL VIDEO

@everyone lagay ng pangalan kung anong member kayo sa script.


Ex. Member 3: Quibuyen, Paolo

Pineda, Darlyn Lee

Regala, Tricia Mae L

Reyes, Riane

Pineda, Jonel

Regala, Arzhlee

Quibuyen, Paolo

Puno, Jessel

INTRO

Member 1 : Hi everyone! In this video, we’re going to learn about nested


loops in the C programming language. Nested loops are loops inside another
loop, and they’re very useful for patterns, grids, and repeating tasks. We’ll
explain what they are and demonstrate them using an IDE.

SECTION 1 – What Are Nested Loops?


Member 2: In C, a nested loop simply means one loop inside another. The
outer loop controls how many times the inner block runs, while the inner loop
repeats actions for each outer loop cycle.

Member 2 : Here’s a simple illustration:


Outer loop → Inner loop → Repeating blocks.
SECTION 2 – Basic Structure

Member 3: Let’s look at the basic form of a nested loop. We’ll write a short C
program that shows how the outer and inner loops work together.

IDE DEMO – Member 3 (typing or screen share):

Code:

#include <stdio.h>

Int main() {
For(int I = 1; I <= 3; i++) {

For(int j = 1; j <= 2; j++) {

Printf(“I = %d, j = %d\n”, I, j);

Return 0;

SECTION 3 – Running the Program

Member 4: Now let’s run the program. Notice the output: for every value of I,
the loop prints two values of j. This shows that the inner loop completes all
its runs before the outer loop increases.

Member 4 (showing output):

I = 1, j = 1

I = 1, j = 2

I = 2, j = 1

I = 2, j = 2

I = 3, j = 1

I = 3, j = 2

SECTION 4 – Pattern Example (Square)

Member 5: One of the most common uses of nested loops is printing shapes
or patterns. Let’s try making a simple square pattern using stars.

IDE DEMO – Member 5:

Code:

#include <stdio.h>

Int main() {

For(int row = 1; row <= 4; row++) {

For(int col = 1; col <= 4; col++) {


Printf(“* “);

Printf(“\n”);

Return 0;

Member 5: The outer loop controls the rows, while the inner loop prints stars
in each row.

SECTION 5 – Pattern Example (Triangle)

Member 6 : Now let’s create a triangle pattern. The inner loop depends on
the outer loop’s value.

(IDE demo included

Code:

For(int I = 1; I <= 5; i++) {

For(int j = 1; j <= I; j++) {

Printf(“* “);

Printf(“\n”);

Member 6:This prints one more star each row, creating a triangle.

SECTION 6 – Summary

Member 7: To summarize,

• Nested loops are loops inside loops.

• The inner loop runs completely before the outer loop moves.
• They’re used for grids, tables, matrix operations, and patterns.”

OUTRO

Member 7: Thank you for watching! We hope this helped you understand
how nested loops work in C. Don’t forget to practice writing your own
programs. See you next time!

You might also like