 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can calculate factorial of a number using macro in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube. My channel will be available there. You can watch various programming related videos here. Now I am going to implement solution of this problem which will be demonstrating you how you can calculate factorial of a number with the help of macro using hash define. So first of all I am including a header file that is stdio.h. Now I am going to define a macro whose name is fact and it will be receiving a parameter n. Now I am going to define its replacement token list. So here I am going to implement a for loop which will repeat n times and this loop will be calculating factorial with the help of this expression that is f equals to f into i. And after that this printf will be displaying calculated factorial on output screen. So this way I have implemented this for loop with two expressions. Now I am going to implement main function so that I can use this macro for execution purpose. So here I am going to declare these variables which I have used in macro or some other variables. So n second variable is f which is initialized with one and third variable is i. Now I am implementing printf which will display the message enter the number on output screen. And the entered number will be received through scanf and that number will be stored inside n variable. Now for factorial calculation I have used this fact and notation. So this notation will be replaced with the help of this replacement token list that is implemented in line number 3 with the help of for loop. So this replacement token list will be available at line number 9 in place of fact n so that factorial of particular number will be calculated. So I have implemented this factorial logic in macro and this factorial calculation will be available on line number 9 while I will be compiling this code. So now I am going to compile and execute this code. So you can see it is asking for number I am entering 5 as input. You can see it is showing the output factorial equals to 120. So the program is working properly. It is showing the correct results on output screen. So this way you can use any type of instructions in macro that you want to replace in the upcoming code. So this is done with the help of hash define. I hope you have understood how we can implement. Sorry how we can calculate factorial with the help of macro using hash define in C programming. If you want to watch more programming related videos you can search my name Sanjay Gupta in YouTube. My channel will be available there. You can also download my programming app TechMS which is available on Google Play. Thank you for watching this video.