Header Ads Widget

How to run c program in command prompt (cmd)

 For running the C program in cmd first we have a gcc compiler .If you have then well and good otherwise you have to install the gcc compiler.

       Install Now

After installing we have to save the path of this gcc compiler by using 

  This PC -> Properties -> Environment Variable ->path

After saving the path . We have to write a c code and save it in a folder let's we create a file sum.c

#include<stdio.h>
int main()
{
int a=8,b=8;
printf("The sum is %d",a+b);
return 0;
}

and we save it in Desktop 

then after open your cmd at that location for it just simply type cmd in the address bar of that file;-


Type cmd



After this cmd will be open at this location:-




before typing the command:-


and type :-  gcc sum.c 

IT will generate a executable code for your file generally file name is a.exe autogenerated.



and then type in cmd :- a

then it will run your code 


Recommended Post:

Hackerearth Problems:-

Hackerrank Problems:-
Data structure:-

Key points:-

 MCQs:-

Post a Comment

0 Comments