 Hello everyone, this is Siddheesh Kumarotki working as a strength professor in Mechanical Engineering department at Walton Institute of Technology, Shalapur. So today we will be discussing about the loop control structures, mainly the do-while loop of control structures. In the last class or the last video lecture we have discussed about the for loop and while loop. This both were the entry loop control structures, it means that the condition was checked before the statements were executed. So the learning outcomes after this video lecture will be, the students will be able to develop programs using various loop control structures that is the do-while loop control structure. The following contents will be discussed in this particular video lecture. The do-while loop flow chart for the do-while loop. The do-while loop, the do-while loop is similar to a while loop except the fact that it is guaranteed to execute at least one time. It means the body of the loop or the statements will be executed once and afterwards the condition is checked. Suppose I want to print some number, okay, the condition is not satisfied. It will print at least one time and afterwards the condition is checked. Do-while loop checks its condition at the bottom of the loop. Which are for the do-while loop, start, that is from where the execution of the program starts, then the initialize phase, initialize means you are giving the initial values, then the body of the loop. It means the statements which are executed after the initialization, okay. I want to have find the sum of even numbers or sum of numbers. Initial value will be i equal to 0. If I want from 1 to 10, it will be 1, it will be the initial value. Body of loop means I want the sum of the numbers. Sum is equal to sum plus i. So sum will be the initial value and i will be the value which will be incrementing values. Then afterwards it goes with the test condition. It means up to what iteration I should do, whether I should do for the end condition, whether I want to do for the up to 10 iterations, I want to do up to 100 that should be that is the test condition. So the test condition basically involves the relational operators greater than, less than, less than or equal to, greater than or equal to or it may be double equal to that is the comparison operator. Then if the condition is true, suppose, then it will go again into the body of the loop and execute it till the condition is false. If the condition is false, it will execute the statement just below the what are the do value. Future for the do value continue, start from where the execution of the program starts. Initialize is the point where we are giving some initial values for calculation purpose like sum equal to 0 where sum is available which is initialized to 0 in order to calculate sum of series 1 to 10. I will be 1 and n will be the 10 in the body of loop. In this various statements are executed after fulfilling the condition. Test here the conditions checked that is the same using the relational operators. The four relational operators we are considering greater than, less than, less than or equal to, greater than or equal to. Doval loop can be or the general form of the doval loop can be written as follows. Do and that the statements to be executed after the condition were to whatever the statement sum I want to find the sum of the numbers. I want to find the sum of the even numbers, sum of odd numbers. I want to check whether the number is a perfect number. Okay. So these are the conditions. I want to perform some operations. Body of the loop mainly consists of this type of statements. And the while that is the condition. So now just pause the video and think whether this doval loop or the for loop is a entry control or exit control loop control structure. The doval loop. I want to calculate. I want to just go with an example calculating the sum of the odd numbers of the series. 1 plus 3 plus 5 plus 7 plus 9 plus 11. I know the addition of the number is 36. It is up to 11. So mainly it includes the hash include iostream.h. Hash include it means the preprocessor file iostream.h it means input output stream header file. It includes two defined objects or predefined objects called see out and see in. See out is basically works as a for printing the displaying value. I want to display some value seen is for like scanf it takes the input value from the user. Hash include conio.h it includes again the two functions that is getCH and clrsr. Clrsr it's deletes the previous value. It omits or deletes the previous value whatever the taken and getCH it takes the whatever the value I have calculated it will be displayed on the screen using the getCH. Then the void main function it void main function is nothing but what is the return type and main is from where the execution of the program starts. So with respect to this integer n it means n value will be up to what are the 11 value okay sum equal to 0 is the initial sum. Initial sum will be obviously 0 and i equal to 1 from where I am starting the loop. See out enter n the n value is the target value up to what I want to continue program or up to what I want to execute the program. Scene n n is the nothing 11 do it will come into the bracket. Now if I modulus of 2 not equal to 0 I want to check whether the number is an odd number or even number. So a number which is perfectly divisible by 2 is an even number a number which is not exactly divisible by 2 is an odd number. So i modulus modulus operator gives me the remainder if they suppose the remainder obtained is not equal to 0 then it will be obviously an odd number. Then I will come inside the loop sum equal to sum plus i I will calculate the sum then I will again increment it I will check once again once again whether the number obtained is an even number odd odd number I will repeat up to i less than or equal to 11. Then I will put the sum of the odd numbers get CH. So let me explain about this program okay first initial sum was 0 and i value was 1 1 modulus of 2 1 is not perfectly divisible by 2 it means its true condition the sum will be 1 then I will increment the i value to 2 increment i plus plus that is i i plus plus is nothing but i equal to i plus 1. Still sum was 1 okay whatever sum equal to sum plus i I have done but 2 is not an odd number its a false condition 2 is perfectly divisible by 2. So the sum will be again 1 now i plus plus i will do to 3 now sum value will be again still 1 okay now i is incremented to 3 then 3 is an odd number its not perfectly divisible by 2 okay so sum will be 1 plus 3 will be 4 now i plus plus i have done 4. Now i value will be again 4 sum value will be 4 now 4 is not perfectly divisible 4 is perfectly divisible by 2 it means its an even number the sum will be 4 again and the i plus plus i will do 5 now sum value is 4 previous sum was 4 and 5 is an odd number okay 5 divided by 2 I say its not completely divisible I will get some 2.5 okay but 5 divide by 2 if I get I will get a remainder as 1 okay then its a true condition so 9 plus so 5 plus 4 will be the 9 then I go to the 6 okay so 6 is a even number so again the sum will be the same thing 9 now 7 is an odd number its a true condition again the same thing so odd number means it will get added okay now it is going to get incremented to 8 the previous sum was 16 now 16 plus whatever the 8 is nothing but the even number false so 16 again sum will be the same thing for 9 it is an odd number its a true condition 16 plus 9 25 now 10 again 10 is an even number false condition so afterwards sum will be the 25 okay 11 11 is an odd number true condition so it will be 25 plus 11 will be 36 so this is up to conditions okay so these are the following references object oriented programming with C plus plus by E Balgur so me thank you.