banner



How to Run a C Program in Putty Windows

How to Compile C Program in Command Instigate?

Penultimate updated on Nov 25,2022 277.8K Views

How to Compile C program in Statement Prompt?

We usually expend a compiler with a graphical exploiter interface, to compile our C program. This can as wel be done by using cmd. The command prompt has a set of steps we need to perform in order to accomplish our curriculum without using a GUI compiling program. Therein clause we would be sympathy how to compile C program in mastery prompt.

Thusly Army of the Pure United States begin with this clause on how to compose C progam in prompt,

How to Compile C Program in Bid Prompt?

STEP 1:

Run the command 'gcc -v' to check if you have a compiler installed. If not you need to download a gcc compiler and install it. You buttocks search for cmd in your windows system to open the mastery instigate.

Output - How to Compile C Program In CMD - EdurekaStride 2:

Make up a c political program and store it in your system. I have written a program to find the Armstrong Amoun and store information technology in the directory user. We would be using pursuing codification.

            #include <stdio.h> int main() { int num, original, rem, sum total = 0; printf("Enter a three digit Number: "); scanf("%d", &num); original = num; spell (original != 0) { rem = primary%10; sum =sum + REM sleep*rem*rapid eye movement sleep; original =original/ 10; } if(sum == num) printf("%d is an Armstrong number.",num); other printf("%d is non an Armstrong number.",num); return 0; }        

STEP 3:

Change the working directory to where you have your C program. You can fare that by using the command 'cd', which changes the directory. We need to pass the name of the directory in which the program is stored.

Object lesson: >cd Desktop

Our program is already in the substance abuser directory so, we don't need to change IT.

STEP 4:

The next step is to compile the political program. To coif this we need to use the command gcc followed by the name of the program we are going to execute. In our case, we will use Satchmo.c.

Output - How to Compile C Program In CMD - Edureka

Aft this, an workable file bequeath be created in the directory that your c file exists in. Eg: Armstrong.exe

STEP 5:

In the next step, we can race the program. This is done away bu bounteous the key of the executable file without whatever extension. On giving this we will get an output. Here, our Armstrong code is dead and we got output for this code.

Output - How to Compile C Program In CMD - Edureka

With this we come to the end of this blog on 'How To Compile C broadcast in Prompt'. I hope you institute this informative and helpful, stay tuned for more tutorials happening similar topics.You may also checkout our training program to bring in-profundity noesis on jQuery along with its various applications, you canenroll here for live online training with 24/7 support and lifetime access.

Got a question for us? Mention them in the comments section of  this blog and we will get back to you.

How to Run a C Program in Putty Windows

Source: https://www.edureka.co/blog/how-to-compile-c-program-in-command-prompt/

0 Response to "How to Run a C Program in Putty Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel