 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print table of a number on output screen as well as into a file using file handling in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube search bar. My channel will be available there. You can watch various programming related videos here. Now I am going to implement the solution of this problem. So first time including header file stdio.h, then another header file stdliv.h. Now I am going to define main function. Inside main, I am declaring variable n and i. Now I am going to declare a file pointer. Name of file pointer is fp. Now I am going to open a file whose name is table.txt and I am opening it in w mode, that is right mode. Because I have to store table of the number into a file. Now I have to check whether this file is open successfully or not. So for that purpose, I am writing this if statement. So if fp is having null, then it means file is not open successfully. Otherwise it is open successfully. So if fp is equals to null, then I can print the message error file cannot be open. So this message will be displayed on output screen and to terminate execution of the program, I am calling exit function. If the if condition is false, then I can write another statements of this program. So the message enter a number will be displayed on output screen and the entered value will be stored inside n variable through this scanf statement. So now n is having the number whose table we want to print on output screen as well as we have to store the table into a file. So for that purpose, I am repeating a loop 10 times. Now inside this loop, first I am calling printf which will display n into i on output screen. So the expression n into i will be calculating different different numbers of table and those numbers will be displayed on output screen. Now to store these output on sorry to store the output into a file, I have to call f printf. Here I am passing first argument as fp. Then in double quotes, person d slash n and then n into i. So you can see this printf will be displaying output on console and this f printf will store output into a file and name of file is table.txt. So this way I have implemented the for loop which will calculating table of a number and the table will be displayed on output screen as well as the table will be stored in a file. Now I can call f close fp so that I can close the open file and then return 0. So this way I have implemented the solution in front of you. Now first let me search whether this table.txt is available or not. So I have to follow this path c drive tc folder and then bin folder. So I have opened bin folder already. You can see the path c drive then tc folder and then bin folder. Now inside bin folder I am pressing t. So you can see the files whose name starts from t are available here and table.txt is not available here. So it means bin folder doesn't contain table.txt. So we have to check whether wboard automatically creates table.txt or not. So for that purpose I am executing this code. I am entering the number 5. So you can see table of 5 is displayed on output screen. Now we have to check whether the table is printed or stored in file or not. So again I am pressing t so above you can see table.txt is created now. And you can see its data. It is containing table of 5. So this way with this program I have displayed table of a number on output screen as well as I have stored the table into a file. I hope you have understood how we can store the data into a file as well as how can we show the same data on output screen using file handling in c programming. If you want to watch more programming related videos you can search my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Thank you for watching this video.