 Hello everyone, myself, Mr. F. R. Sayed. I work as an assistant professor in the Department of Computer Science and Engineering at Walchand Institute of Technology, Saulapur. The topic for my today's lecture is the break, continue and go to statements in C-language. Now, at the end of the session, the students will be able to explain the functionality of the break, continue and go to statements and then apply the break or continue statement if required for solving a given problem. The topics covered under this lecture are first of all the break statement description followed by the continue statement and then a brief introduction about the go to statement and then a sample program explaining the use of the statements followed by an assignment for the students based on the programming concepts of the video lecture and let us first see the break statement. Now, sometimes there may be a need to skip some statements inside the loop or terminate the loop immediately without checking the test condition. Now, for such cases, the break and continue statements are used. Let us see what does the break statement do? The break statement will terminate the loop when it is encountered or executed. That means when the break statement is executed inside a loop, the control is automatically transferred to the next statement after the loop. That is the immediate next statement coming after the loop. Now, generally a break statement is associated with an if statement, but it could also be used within the switch case statement. This slide shows us the application of the break statement meaning where exactly to use the break statement. Now, first of all we have the while loop although we know that any type of loop could be taken, but here as an example we have taken the while loop. Now, in this while loop we have the expression given as long as this expression is true, the condition is true. This loop goes on executing assuming the control comes inside the loop. Now, this is the list of statements named as S1 would get executed first. After that we have this if statement where we have a particular condition given in the bracket. Now, if this condition is true then this statement of break gets executed meaning if such a thing happens the entire loop terminates and the control is transferred from this point to the statement immediately after the while loop. But assume if the condition to break is currently holding false, the list of statements named as S2 would be executed and once again the control is transferred to the test condition of the while statement and the process goes on continuing. Now, next we see the continuous statement. Now, like the break statement the continuous statement is also used to alter the normal flow of the program execution. Sometimes there may be a need to take the program execution control to the beginning of the loop and when it goes to the beginning of the loop the remaining statements inside the loop are bypassed meaning those will not get executed for that iteration. Now, in order to achieve such a task the continuous statement will help the programmer to do so. Now, when a continuous statement is executed inside a loop the control will automatically pass to the beginning of the loop or to the start of the loop and like break statement the continuous statement can also be associated with an if statement meaning it can be used with a if statement but generally it is not used with the switch case statement. Now, next we have the application of the continuous statement which tells us where exactly to use the continuous statement. Like the break statement the continue can also be used with any type of loop. In this case as an example we have taken the for loop in which we have made use of the continuous statement. First of all we have under the for loop the three sections of initialization, condition and iteration and as we know the flow of execution for a for loop the initialization part executes first then control is transferred to the condition and let us assume currently the condition is holding true. Then the control enters inside the loop the list of statements named as s1 would be executed and after that we have an if statement where there is an expression or condition to be checked and if this condition is currently holding true the continuous statement is executed and if the continuous statement is executed the control from over here directly passes to the iteration part and the statements s2 will not be executed for that iteration of the loop. So from here if the control is transferred to the iteration once again the condition is checked and the same procedure goes on continuing and if suppose this test expression is false then we have a case that the list of statements s2 would be executed. So this is the basic difference between the break and continue statement. Summarizing we have a point that the break statement terminates the loop permanently whereas the continue statement it terminates the remaining statements of the loop or it leaves the remaining statements of the loop un-executed and directly goes to the top of the loop. Lastly we have the go to statement. The go to statement is a jumping statement used in C that transfers the execution control from one statement to another statement where a label is defined. Now the go to statement transfers the execution control of the program within the same block and there must be a label where the control is to be transferred. The go to statement can be used to transfer the execution control either from top to bottom or from bottom to top. And this is the syntax of defining a label. First of all a label name is to be given followed by a colon symbol and then the statements associated with which is the label defined. Now some instructions regarding the go to statement the use of go to should be made as minimum as possible because it makes difficult to trace the control of the program and which may make the program even hard to understand and modify. And any program that makes use of go to can be rewritten and we do have a better way of writing the same code with go to and replace it with another code that could make use of if for while do while and switch statements respectively. Next we have a sample program. The aim of this program is to display the multiples of the numbers from number two to five which are in value less than 10. So here we have the code. First of all we include the header file stdio.h then the main function definition starts from over here then we have some variables declared initialized not over here but inside the loop then we have the for loop and we have nested for loop the outer loop has the counter I which ranges from two to five. So this outer loop will actually help us to multiply the number with other numbers so that we can find out the multiples meaning the outer number is for finding the multiples of whereas the inner loop is actually used to multiply its value with i so that we can have the multiple of i and j. Now the inner loop goes from j equal to one to five. If i into j is greater than or equal to 10 it breaks now why does this condition occur it is because strictly in the problem statement it has been given that we require the multiples of the numbers which should be less than 10. So if it is so it breaks the inner most loop but if it is not so it directly prints that number with the help of %d and %d replaced by i into j. So this loop goes on continuing as long as j less than equal to five condition is holding once we come out of this loop we print the next numbers multiple on the next time and this process goes on continuing from the number two to five so that for every multiple we check if its value is less than 10 we print if it is not so we break that loop. This is the output the first line shows the multiples of the number two two four six eight ten not being used then the multiples of three on the next line three six nine then the multiples of four four and eight and then the multiples of five that is five. Now next the students are expected to think and write the answer to the following question write a C program to display the following output using nested loops. So now pause the video and write the answer okay now in order to get this output we first need to understand what does this output require us in this output the first line we have number one the second line two value is skipped the next line also two value is skipped. So in order to display this output we can use the continuous statement a C program to display the required loop output so this is the inclusion of the header file and the main function declaration then the variable declaration and then we start the loop i equal to one i less than equal to four i plus plus and if i value is equal to two we continue meaning we skip the value of i and similarly we have an inner loop where j value goes on from one to the value of i and in that loop also if j is equal to two we continue meaning we skip if it is not so we print the value of j with the help of percent hd and this goes on containing for every value hence and for every line we display the numbers in a new line so therefore we include the slash n statement and that concludes the program these are the references used for the video lecture the let us see book by a shanty karnatkar and the websites of include help dot com and tutorials point dot com or c programming thank you