 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can find out maximum among three numbers using nested if and logical and operator. Before starting, you can note my information. You can follow or subscribe my YouTube channel through this URL that is youtube.com slash sanjaygupta underscore tech school. You can download my programming app that is Techimage which is available on Google Play. Now coming on to the topic, here you have to notice that all the entered numbers must be different. So I am implementing a code in C programming language for demonstration. First I am going to implement the solution using nested if and then I will be using logical and operator. So I am declaring three variables ABC then with the help of printf I want to show this message enter three numbers on console then scanf. I am using three percenties because three numbers are required and these three numbers will be stored inside ABC variables. Now first I am going to compare A with B. This is first condition. If this condition is true, then control will be transferred inside true block. So I have to compare A with C because condition is true. That's why A is greater than B and then in second condition I am checking A with C. So if this condition is also true then I can print percent D is maximum and A. So value of A with this is max will be printed on console. If this condition is false then printer will display percent D is max and here variable will be C because if this condition A greater than C is false then automatically C will be maximum. So this message will be displayed. So this is the true block of this first condition which is available at line number nine. Now I am going to implement its false block that is else here. If this first condition that is A greater than B if it is false then B is greater than A. So here I have to compare B with C. If this condition is true then I have to print percent D is max and the variable will be B. So B is max will be displayed here. If this condition is false then percent D is max and again C will be displayed here. So this way I have implemented the complete code using nested if. So you can see again this is the true block of this first condition and then it's false block. Inside true block again a condition is available. This is nested if if this second condition is true its true block will be executed otherwise it's false block. If first condition is false then control will be transferred inside this else block and here if condition is also available which will decide whether true part will be executed or false. Now I am going to execute this code. I am entering three numbers four five and six. You can see the output six is max is displayed on console. So friends with the help of this nested if statement I have I have implemented how we can compare three numbers to find out which one is maximum. Now I am going to convert this code with the help of logical and operator. So printf and scanf will remain same if condition will change. So if condition is A greater than B now I am using this logical and operator and here I am applying another condition A greater than C. So logical and operator joins two conditions together. So first condition is A greater than B and second condition is A greater than C and I have put a logical and operator in between these two conditions. So if both the conditions are true then if true block will be executed otherwise control will be transferred to else block. So here I can print percent D is max and value of A. If this condition is false here I have to check B with A and B with C. This is another if condition. It is also implemented with logical and operator if it is true then percent D is max and value of B will be displayed and if this condition is also false then printf will display percent D is max and value of C. So this is the complete code which will compare values of three variables for maximum and it is implemented with the help of this logical and operator. Now again I am executing this code. I am entering same numbers four five and six. You can see the output six is maximum. So friends this way you can implement how we can find out maximum among three numbers. I have implemented this code with the help of Dastardiff as well as with the help of logical and operator. So you can choose any particular way which is suitable for you or which you can easily understand. According to me logical and operator implementation is easy because if you want to check four five or six numbers for maximum then Dastardiff will become difficult and logical and is simpler or easier as compared to Dastardiff. So you can prefer logical and operation in place of Dastardiff operation. I hope you have understood both the concepts well. If you want to watch more programming related videos you can visit my youtube channel through this URL youtube.com slash sanjay gupta underscore tech school. Thank you for watching this video.