 Hello everyone, myself, Mr. F. R. Syed. I work as an assistant professor in the department of computer science and engineering at Olsen Institute of Technology, Sulapur. The topic for my today's lecture is do value. At the end of this session, the students will be able to explain the basic working principle of the do-while loop and apply the do-while loop for a given problem statement. Now, these are the different types of loops, for loop, while loop and the do-while loop. Basically in this lecture, we will be dealing with the do-while loop. Now, there is a slight difference between the working of the while loop and the do-while loop. We have seen the while loop in the previous lecture. Now, what exactly is the difference? The difference is the place where the condition is checked. We do know that a condition needs to be true for a loop to execute or for a loop to go on executing and based on this fact, the while loop is sometimes called as entry controlled loop whereas, the do-while loop is called as exit controlled loop. This is the syntax of the do-while loop. We see the do keyword followed by the opening curly brace of the loop. Then we have a block of statements or a sequence of statements which need to be executed. Then the closing brace of the block and at the end, we have the while keyword being used followed by the condition to be checked inside the round brackets. Now, let us move on. The do-while loop checks the condition after executing the statements within the loop. That is, the condition is checked after executing the statements meaning it will control the program execution from exiting from the loop. Now, this is in contrast with the while loop which checks the condition before executing the statements within the loop. So, this is the difference between the while loop and the do-while loop. The do-while loop executes the statements then checks the condition whereas, the while loop checks the condition first and then goes on to execute the statements. Now, this implies that the do-while loop would execute the block of statements at least once even if the condition fails for the first time. The while loop will not execute the statements if condition fails for the first time. Now let us see a comparison between the while loop and the do-while loops. As we know the while loop first point it is an entry control loop whereas, the do-while loop it is an exit controlled loop. Let us understand why is it called as entry controlled loop while loop? Entry controlled loop means the entry of the program execution control in this loop is controlled at the entry part therefore, entry controlled loop whereas, in case of do-while loop the program execution control whether it will get exited from the loop is controlled by the do-while loop. So, therefore, the name exit controlled loop. Second point the condition is checked before execution of the statements in the loop that is at the starting of the loop in case of while whereas, in case of do-while the condition is checked after executing the statements inside the loop. Then the third point the loop does not execute if condition is false at the first iteration meaning if the condition is false the while loop will never execute, but this is not the case with do-while loop. The do-while loop it executes at least once even if the condition is false at the first iteration. So, this is a big difference between the while loop and the do-while loop. So, applications which do require us to display some part of code even if a condition is false will definitely make use of the do-while loop. Now, we have a sample program under the do-while loop. Now, the sample program of finding out the product of two numbers A and B without using the multiplication operator meaning we need to find out the product of A and B two integers without making use of multiplication operation. So, how can it be done? Yes, it can be done using successive addition. Let us see the code for that. The first line as usual inclusion of the header file stdio.h then the next line we have the main function int main opening curly brace for the main function and then we have three variables declared and initialized at the same point A initialized to 6, B initialized to 4 and A and S variable initialized to 0. Now next line the do-while loop begins and inside the loop we have the first statement as A and S equal to A and S plus A that means the value of A would be added to the current value of A and S and then in the next line decrement the value of B by 1 with the help of B minus minus post decrement operator. Then this is a closing brace of the do block and then we have the while condition while B is greater than 0. Now, how does this code run or how does it calculate the product of two numbers? So, we will see it. Now, the value of A is added to A and S every time and the B value is accordingly decremented by 1. So, that means if B value is 4 the value of A equal to 6 is added to A and S every time and this goes on continuing 4 times that means 6 is added to itself 4 times that is 6 plus 6 plus 6 plus 6 added to the value of A and S 0 to get value as 24. So, that answer we get over here and displayed with the help of print of statement A and S equal to percentage D where percentage D is replaced by the A and S value of 24 and we do know that adding 6 to itself 4 times yields nothing, but product of two numbers 6 and 4. So, 6 4 is a 24 is a result, but of course without using the multiplication operator. Then we conclude the program with the return statement for the main function as a last statement and then the closing calibers of the main function. Now, next the students are expected to think and write the answer to the following question. Write a C program to find the value of A raised to B where A is the base and B is the power or exponent where the values of A and B are 3 and 4 respectively. So, now pause the video and write your answer ok. So now, we have the C program to display the value of A raised to B that is A value equal to 3 B equal to 4. So, we see the code first hash include stdio.h the inclusion of the header file stdio then the main function begins and inside the main function we declare 3 variables as A, B and A and S and of course, we initialize it at the same point A equal to 3 B equal to 4 and A and S equal to 1. Now, the answer expected is 3 raised to 4 which is nothing, but equal to 81, but how can it be achieved you know making use of do while loop we can do one thing we can multiply 3 with itself 4 times. So, that means 3 into 3 into 3 into 3 would yield value as 81. So, for that we make use of do while loop. So, A and S equal to A and S multiplied by A that means first time the value of 3 is multiplied with A and S current value of A and S is 1. So, 3 multiplied by 1 equal to 3. So, 3 is stored in A and S and accordingly B value is decremented by 1. So, this loop goes on continuing for as long as B is greater than 0 that means from value 4 of B it gets reduced to 3 then 2 then 1 and finally, 0. So, this statement A and S equal to A and S multiplied by A it repeats 4 times. So, in short the do while loop execute 4 times meaning 3 multiplied by itself for 4 times will yield you the answer as 3 raised to 4 equal to 81. So, after that we take the printf statement for displaying the answer as A and S equal to percentage D where percentage D is replaced with the value of A and S and then the return statement which concludes the program. Now, this is the reference used for the video lecture the let us see book by Yashwan P. Karnitkar of 13th edition. Thank you.