 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how to subtract two numbers without using minus operator in C programming. Before starting, you can note my information, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app, Techimace, which is available on Google Play. Now I am going to implement a program in C which will demonstrate you how you can subtract two numbers without using minus operator. So first time including header file that is stdio.h. Now I am defining main function. Inside main I am declaring three variables n1, n2, and num. Now with the help of printf, the masses enter two numbers will be displayed on console. To read two numbers from console, I am writing scanf statement. So first number will be stored inside n1, and second number will be stored inside n2. Now I have to implement the logic. With the help of this logic you will be able to understand how you can subtract two numbers without using minus operator in the program. So first time calculating complement of n2. So n2 is the second number. So I am calculating its once complement. So once complement of n2 will be stored inside num variable. Now I have to calculate its two's complement. So if I add one in one's complement, then two's complement will be received. So right now num variable is containing two's complement of n2. So whatever value will be available inside n2. First its once complement will be calculated at line number 9 and at line number 10 its two's complement will be calculated. Now I have to perform this operation. So n1 is containing first number and num is containing two's complement of n2. So I am adding n1 and num and the final result will be assigned into num variable. So num is containing the subtraction result of n1 and n2. So that value can be printed with the help of this printf statement. So I am printing num on console. So this way I have implemented the logic in front of you. So in short I have calculated two's complement of n2 that is available inside num variable. Then I have added that num variable in n1 and the calculated result is again stored inside num variable and the final result of num will be displayed on console and which is the subtraction of n1 and n2 variables. So now I am going to execute this code. I have to enter two numbers and their subtraction will be displayed on console. So now I am going to execute this code. You can see it is asking for two numbers. So I have entered first number as 10 and second number as 5. You can see the result. It is showing 5 which is the correct result. Again I am going to execute this code. This time first number is 5 and second number is 10. You can see the result minus 5 is displayed which is correct again. Third time again I am executing this code. This time I am entering same numbers in both n1 and n2. You can see the result. It is showing 0. So this way with the help of complementary method I have subtracted two numbers without using minus operator in the program. So I hope you have understood the simple logic through which you can subtract two numbers without using minus operator in the program. So I hope you have understood the concept well. If you want to watch more programming related videos you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app TechMS which is available on Google Play. Thank you for watching this video.