 Hello everyone, myself Mr. F. R. Syed. I work as an assistant professor in the department of computer science and engineering at Walgen Institute of Technology, Solaapur. The topic for my today's lecture is for loop, that is for loop in C programming language. At the end of the session, the students will be able to explain the basic working principle of the for loop and then apply the for loop for a given problem statement. Now, the topics to be covered in this lecture are, first of all we will be dealing with introduction to loops, then we will go to the types of loops and then we will see the syntax of the for loop followed by a sample program and at the end an assignment for the students based upon the programming concepts. Okay, now let us first see introduction to loops. Typically in a C program, the statements are executed in a sequential manner, meaning the first statement inside a function is executed first, which is then followed by the second statement and so on. However, in some situations, a block of code may need to be executed more than once, that is several number of times. So, this may involve repeating some portion of the program either a specified number of times or until a particular condition is satisfied. Now, such situations may require the use of a loop control instruction. Now, let us first see the loops flow chart that explains what is a loop, how does a loop work. Now, let us suppose the control of program execution comes to the point where the loop is going to start. So, there we are going to check the condition, if the condition turns out to be true, then the code will be executed, that is the code inside the loop will be executed, here we have turned it as a conditional code and this goes on continuing. If the condition turns out to be false, then the loop is terminated and the statement after the loop is executed. Let us see the types of loops in C language. In C language, we have three different types of loops being used. First one is the for loop, second one is the while loop and third one is the do while loop. Now, basically we will be seeing the for loop first. Now, talking about the for loop, it is the most popular looping instruction being used by programmers, it is widely used. Now, it allows the programmer to specify three things about a loop. The first one is the initialization part, where it allows us to specify the initial value for the loop counter. Second is checking whether the loop has been executed for a desired number of times. Now, this section is called as conditional checking and then we have the third part where incrementing or decrementing the value of the loop counter every time after the statements in the loop have been executed. Now, this section is called as iteration section. So, after every execution of the loop, by what value should the loop counter be incremented or decremented is specified in the iteration part. Now, next we have the general form of the for statement. Inside the for loop as shown in the slide, we have three sections. The first one is the initialization section terminated by the semicolon. Then we have the condition section, then the semicolon and then we have the iteration part and then followed by the curly braces within which the block of statements is written. Now, let us first try to understand how does this loop work. Now, the initialization part occurs once. After that, the control is transferred to the condition part where the condition is checked and if it is true, the statements inside the loop will be executed and after executing the last statement in the loop, the control then transfers to the iteration part and after iteration once again the control is transferred to the condition part and if the condition still holds true, then the control is once again transferred to the statements inside the loop. This process then continues. Hence, the looping statement works in this manner. Now, let us see a sample program to know the working of for loop or using the for loop, how can we perform a task of displaying the multiples of the number 5. Now, basically in a C program, we first of all have the first line displaying the inclusion of header files. That is the first line is hash include stdio.h. This is standard input output header file. Then we have the declaration of the main function followed by the opening curly braces of the main function. Then we have declaration of an integer variable i. This i variable would be used as a loop counter. Now, inside the for loop, we have these three sections. Of course, the first section i equal to 1 is the initialization part. Then we have i less than equal to 10. This is the condition part and then i equal to i plus 1 is the iteration part. The other way to write down this is i plus plus. Then we have the opening of the loop. It includes only one statement print f 5 multiplied by percent hd equal to percent hd. The first percent hd would be replaced by the value of i and second percent hd would be replaced by the value of 5 into i. So, basically we want the output as 5 into 1 equal to 5, 5 into 2 equal to 10, 5 into 3 equal to 15 and so on. Now, this process goes on continuing as long as the value of i is less than equal to 10 and every time the value of i is incremented by 1 and once again the condition is checked and the looping statements would be executed. So, this is how the for loop works and this indicates the end of the loop and then of course, at the end we have the return statement and this concludes the main function. Now, the students are expected to think and write the answer to the following question. Now, write a C program to display even numbers between 0 to 20. Now, students are expected to make use of a for loop and answer this question. So, now pause the video and write your answer. So, now we have the answer to the question being asked. The question was C program to display even numbers between 0 to 20. Now, as we know what is an even number, a number that is divisible by 2 is an even number. So, we have written a code for that. The first line being inclusion of the header file stdio.h, then starting of the main function, then declaration of a variable i which will work as a loop counter in this case and then the for loop or i equal to 0, i less than equal to 20, i equal to i plus 2. Of course, this is initialization, condition and iteration part. So, what will happen when the value of i is equal to 0? The condition is checked, 0 is less than equal to 20, it is true and then this line is printed that is percentage d value of i that means, 0 is printed. After that in iteration part, i value is incremented to 2, then condition is checked and then value of 2 is displayed. So, this part goes on continuing and it terminates when this condition feels. So, that means, we have as an output for this program values of 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 and 20 and thus this concludes the program with the return statement. Now, these are the references used for the video lecture. The Let Us See book of thirteenth edition by Yashwant P. Kanitkar and the website of www.tutorialspoint.com slash c programming. Thank you.