 Hello everyone welcome to the video lecture where we are going to discuss about the decision making statements used in programming language C. Learning outcome at the end of this session students will be able to write a C program using control statement F. Now what are these decision making statements and why do we need them in C. Many times in real life as well we need to take some decisions based on certain conditions. For example if the highway is busy I may take the diversion or if the climate is cloudy I may carry umbrella with me. So there are certain actions that we perform based on some conditions. So in C as well we must alter the program's flow of execution based on certain conditions. Decision making statements are thus used so as to provide the control flow inside our program. Also these are used for implementing condition based execution. There are various ways of implementing decision making statements such as if statement, if else statement, conditional operators, if else if and switch case. The conditional operators are nothing but these are logically similar to if else statement. For this video lecture we are going to focus on the first type of decision making statement that is nothing but if statement. Let us look into detail how exactly if works. So for this we need to use a test expression that is nothing but a condition. So if this text expression evolves to true then in that case the statements that we write inside if that is nothing but body of if will be executed and after that the statements which are written after the corresponding body of if will be executed. So for this the test expression has to be true or it should evolve to true. If the condition evaluates to false in that case the body of if that is nothing but statements belonging to this if structure will be skipped from the part of execution and the program will directly continue to execute statements just below body of if. Let us look into detail about the syntax of how if is written. So the keyword if is followed by test expression that is nothing but condition that we want to implement followed by a pair of curly brackets and inside that we write the statements. Similarly we do not put semicolon after the test expression up till now we have seen that every statement inside C has to be terminated with a semicolon. When we are going to discuss about some examples we will see what happens if I put semicolon inside C or so the value of the test expression it should always evolve to a Boolean value. Time to reflect. So as to check that if the given number is greater than zero which of the following set of statements is correct. Go to the following options pause the video for a moment and think about it. I hope that you have got the correct corresponding answer. Now let us look and detail and let us look into detail and check with all of the options. So for the first one if is followed by a pair of round brackets and some condition is put inside it followed by the statement belonging to if. What about option B? As you can see a curly parenthesis has been used here which is syntactically wrong. Also in the C option round brackets have not been used therefore option C is incorrect while as in case of option D although it is syntactically correct but the execution of this is different because putting a semicolon after if is equivalent to we are not using any condition inside our program. So no matter what is the value of number either less than zero or greater than zero for each of the cases the statement will be always executed. So print of doesn't belong to if. So therefore the corresponding answer is nothing but option A. Let us try to verify whether the answer is correct or not. So first of all I will declare a variable integer n then we need to check whether the given number is positive or not. So what is the condition? If n is greater than zero I will say that the number is greater than zero. Let us try to implement the example just now that we have discussed okay. So I have declared a variable n whose value is 10. Now let us see what happens when I run the code. As you can see here value of n being 10 and greater than zero the corresponding answer is shown as number is positive. Now what if I put a semicolon after this let us try to find out the answer. So now putting semicolon how does this C program will execute? Let us see there. Now again the output is shown as number is positive. Let us make these some changes. Now I will put a number which is nothing but minus 8 which is basically negative number and it is less than zero and let us try to see what happens with the corresponding answer. Now as you can see here the still number is positive statementings being executed means what the corresponding condition is not getting tested. Therefore putting semicolon after if inside the statement is as good as we are not implementing any condition inside C. Let us actually try to write a C code using code blocks. So the given problem statement is to check if the given number is greater than 10 or not. What can be the algorithm for writing this particular code? Let us start from the statement then we have start and let us read the number. If the corresponding number is greater than 10 we will print the message that n is greater and we will stop. Let us try to write down this code inside code blocks. So we have to give a message that enter a number we will ask the user to enter a number and we will read the value from user. Since we are taking an integer value or integer variable the format specified that we will use is nothing but %t. Now how to write down the condition inside C? First of all we will write the keyword if followed by condition. So the given condition is n should be greater than 10. So this is nothing but a relational operator. Generally if for putting conditions we use the relational operators. Now after that we need to write down some statements. So it must be noted that the default scope of if is nothing but the immediate statement after if. So what is the statement that we should write if the condition is true then we will write that the given number is greater than 10 and the value of corresponding variable n. This is how we write down the code inside code blocks. It must be noted that if we are putting a single statement in inside if then the writing these curly brackets it can be omitted. Now whenever we see that if the condition is false what happens and let us try to build this program and run it. So I enter a number which is nothing but 12. As you can see here 12 is greater than 10 the output is shown as well as the statement like this is how if works is being displayed. Now what if I give a value which is not greater than 10. Now what if I give a value which is not greater than 10. Let us try to rerun the program. I will give the value as minus 9. Minus 9 is not greater than 10. Now you can see here the first statement that we had written inside the ifs that is nothing but body of if it is not getting executed because the condition is false. So as you can see here the value of n which is nothing but minus 9 is not greater than 10. This condition prevails to false therefore this statement is skipped from the part of execution and the program will directly continue to execute which are written after the body of statements of if. Let us try to write down one more program where I need to check if the number is divisible by 511. So what can be the condition for this? For checking the divisibility we can check the remainder. If the corresponding remainder happens to be 0 that indicates that the number is exactly divisible by 5. So accordingly I will write here is divisible by 5. Now let us just try to comment this statement. We must put the ground brackets. Now I will give a value which is nothing but 10. It is divisible by 5. So 10 is divisible by 5. The correct answer is being displayed. Now let us rerun the program and I will give the value as 34. Now as you can see a no output is being displayed means what? If the condition happens to be false in that case the statement whichever we write inside if those will be skipped from the part of execution. This video was created by using following references. You can also go for using multiple online resources available. Thank you.