 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I will explain how you can find out minimum from and input numbers. Before starting, if you go to detail or description of this video, you will find links of various players so you can follow them if you want to learn programming. Now, coming on to this problem, so first I am going to explain it in proper terms then I will be converting that explanation into a C program. So here I am going to take two inputs, input number one and input number two. So input number one will be the value of n. Like this n will tell you how many numbers you are going to repeat from the user so that we can identify the minimum. After reading this n, I am going to implement a loop and this loop will depend upon the value n. So for example, let's say you entered n as 5, you entered n as 5, so it means you need to find out minimum from 5 values. So loop will repeat 5 times and inside that loop, I am going to receive my second input. So loop will repeat 5 times so you need to provide 5 different values and along with that input, you need to calculate the minimum as well. And after completion of that loop, you can print a particular variable which will be holding the minimum value. So now I am going to implement this solution with an epoxy program so that you can understand it. So first I am declaring some variables. So here you can see these are four variables and will be holding how many numbers or quantity. I will for loop iteration, well will be having second input and this is min which will be holding the minimum value after completion of the loop. And its initial value is 3, 2, 7, 6, 7 which is the highest value of integer. So if I take 0 here, let's say if I put 0 here, so what will happen? In case of minimum equals to 0, so if I provide let's say n as 5 and if I provide these numbers, as input to inside loop, these are 5 different numbers and I need to identify which is the minimum. So if min is 0 and I am going to compare this variable with these 5 values, so minimum will remain 0 because 0 is minimum as compared to these values. So I can't put 0 here, that's why I am putting the highest value. So if I compare 10 with this number, so this number is greater as compared to 10, so it will be replaced and 10 will be assigned inside that variable. So whenever you want to identify minimum, so don't put 0 because 0 is already a minimum format of number. So put the highest value and then try to identify minimum and if you didn't understand this right now, so let me complete this program. After completion of program, I will iterate this line by line and I will explain all lines with respect to input number 2. So then you will identify like if we put 0 minimum, what will happen? And if we put this value, then what will happen? So don't feel any problem here, still here. So this is my printf which will print enter value of n and I am going to read value of n inside n variable. So it means I have a number which will tell like I am going to receive those numbers or those many numbers from which I need to identify the minimum. So that is stored inside n variable. Now here I have implemented a for loop. So for loop is repeating n times. Now inside this for loop, I need to receive input number 2. Those are different values and input depends upon n. So n will tell like how many numbers we need to input. So printf then slash n enter percent d number. And here I am putting i. So what will happen? It will display enter then I will be printed here in place of percent d and then none. So it will display enter first number. Second time it will print enter second number because I will become 2. So this way you can print this message that scanf percent d and percent and here I am using the variable value. Now if I need to compare this value, so value will be having these different values and I have to compare this value with this minimum. Now if value is less than min, so min will be having this value. This is the condition. So this loop is completed here. After completion of this loop I can print minimum equals to percent d and I can print min here. So this is the complete program. Now I am going to explain it line by line so that you can understand it completely. So let's say right now it is not having this value. Min is having 0. Min is having 0. And n is 5. Loop will repeat 5 times. So first time it will display enter first number. So I mentioned printf like this enter for sending num. So it will be printing enter first num. So this way it will display a message. So you will enter a number. Let's say I enter 10. So 10 will be stored inside this value. So value of this variable is right now and now compare this value less than min. So let's say min is 0 and value is 10. So 10 less than 0. Is it true or false? 10 less than 0. So 10 is less than 0. No. So this condition will be false. It means value will not assign it to min. Then we enter 20. So 20 is not less than 0. 50 is not less than 0. So now I hope you understood why I didn't provide it. Because 0 is the smallest positive number. So if we start min with 0. So these numbers will not be assigned to min. So I am removing this. Now min is 3, 2, 7, 6, 7. Now compare val with min. So val is 10 and min is 3, 2, 7, 6, 7. So this time this condition will be true. So val will be assigned to min. So new value of minimum will be 10. So earlier it was this. Now it will be having this value. Again i++. So I will become 2. So here this time it will print enter. Second number. This way it will print the message. So let's say this time you entered value as 20. This time you entered value as 20. So val is 20 and min is 10. So 20 less than 10 false. It means this statement will not be performed. So min will remain 10. This time because this condition was false. So i++, i will become 3. So this message will be printed enter third number. And let's say you entered 5 this time. So value of val variable is 5 now. Check this. Val is 5. Minus 10. So 5 less than 10. It is true. So value of val variable will be assigned to min. So its value is now 5. So this way this loop will iterate and it will repeat n numbers. Each number will be compared with min. If new number is less than min it will be assigned to min. If it is not then that rotation will be scripted. And after completion of this loop, after completion of this loop whatever value will be in min variable will be printed on output screen as the result. So i hope you understood how we can identify which is the minimum value from and input numbers. So first we need to take the quantity like how many numbers are there and with the help of loop we can receive those different numbers from the user and we can identify many of them. So i hope you understood whatever i explained in this video. If you want to watch more programming related videos you can open my channel, go to playlist and you can watch more than 1000 videos here. So do watch them and i hope you understood whatever i explained in this video. Thank you for watching this video.