Nested loops with Same max value in C - C Programming Tutorial 61

preview_player
Показать описание
Notes for You:: Nested loops with Same max value in C - C Programming Tutorial 61
- If required we can place one loop inside another loop, which is called as nesting of loops.

Nested for loops:
- If required we can place one for loop inside another for loop; which is called as nesting of for loops or nested for loops.

Case 1: Nested for loops with same max value, are called quadratic loops.

for(i=0; i<n; i++) // outer for loop
{
for(j=0; j<n; j++) // inner for loop
{
sequence of statement(s); // n x n times
}
}

Example 1:
int i=0;
int j=0;

for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("Hello World\n"); // 2 x 2 = 4 times
}
}

Example 2:
int i=0;
int j=0;

for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
printf("Hello World\n"); // 3 x 3 = 9 times
}
}

Note:
- replace < with less-than symbol.

=========================================

Follow the link for next video:

Follow the link for previous video:

=========================================

C Programming Tutorials Playlist:

=========================================
Watch My Other Useful Tutorials:-

Computer Programming Fundamentals Playlist:-

C Practical LAB Exercises Playlist:-

C++ Tutorials Playlist:

=========================================

► Subscribe to our YouTube channel:

► Visit our Website:

=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
Рекомендации по теме
Комментарии
Автор

Answer the following questions: Let's see who gives the best answer
1. What is nesting of loops ?

ChidresTechTutorials