Step 1: Download MinGW
Go to the website of Mingw and download Mingw from it according to your Operating System.
Link: https://sourceforge.net/projects/mingw/

Click on Download and download it.
Step 2: Install MinGW
Go where you downloaded the minGW and open it.

Click on Install.

Click on Continue and minGW will start installing.
After the installation this windows will get open.

Click on these packages and mark them for installation.

Click on Installation and then click on Apply Changes.

Click on Apply and the packages will start getting downloaded that will take upto 5 minutes so let it to get downloaded and finally after complete downloaded, close it.
Step 3: Set MinGW Path
Go where you downloaded MinGW and open that folder and then open bin folder in it And copy it's Path.

Go to your settings and search system properties/environment variable and then navigate to EnvironmentVariables>Path of System Variables>Edit>New and then paste the path you copied and OK all the windows.

Now open VS Code, and then open Terminal in your c/c++ file And use following commands for running c/c++ codes.
• For C - gcc ./filename.c -o exefilename.exe - type this in the terminal and press enter, this command will create an exe file with the given name after -o i.e "exefilename".

Now type ./exefilename.exe in terminal and press Enter. This will show the output of your C file in the terminal.

• For C++ - Just replace the gcc with g++ and all process same.