banner



How to Run a C Program in Putty in Windows

How to Compile C Plan in Command Prompt?

Last updated connected Nov 25,2022 277.8K Views

How to Amass C Program in Command Prompt?

We usually use a compiler with a graphical interface, to compile our C program. This can also be done by using cmd. The mastery prompt has a set of steps we need to perform in order to execute our computer program without using a GUI compiler. In this article we would be understanding how to roll up C program in prompt.

So let us get with this article happening how to compile C progam in prompt,

How to Compile C Program in Command Prompt?

STEP 1:

Run the command 'gcc -v' to check if you have a compiler installed. If non you need to download a gcc compiler and install it. You can hunting for cmd in your windows organisation to open the command prompt.

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

Create a C program and store it in your scheme. I have engrossed a program to find the Armstrong Number and store it in the directory exploiter. We would be exploitation following code.

            #include <stdio.h> int main() { int num, original, rapid eye movement, tot up = 0; printf("Enter a deuce-ac digit Telephone number: "); scanf("%d", &num); original = num; while (freehand != 0) { rem = daring%10; heart and soul =sum + rem*rem*rem; original =original/ 10; } if(sum == num) printf("%d is an Armstrong number.",num); other printf("%d is not an Satchmo number.",num); get back 0; }        

STEP 3:

Change the on the job directory to where you have your C program. You can suffice that away exploitation the mastery 'cd', which changes the directory. We need to pass the name of the directory in which the curriculum is stored.

Example: >cd Desktop

Our program is already in the user directory so, we don't need to change it.

Ill-trea 4:

The next step is to collect the program. To practice this we demand to apply the dominate gcc followed by the name of the program we are expiration to execute. In our case, we will use Armstrong.c.

Output - How to Compile C Program In CMD - Edureka

After this, an executable file will be created in the directory that your c file exists in. Eg: Armstrong.exe

Gradation 5:

In the next footmark, we can test the syllabu. This is done by simply giving the name of the possible file without any extension. On giving this we leave get an output. Here, our Louis Armstrong cypher is dead and we got output for this code.

Output - How to Compile C Program In CMD - Edureka

With this we come to the ending of this blog on 'How To Collect C program in Command Prompt'. I hope you saved this informative and helpful, stay adjusted for more tutorials along similar topics.You may also checkout our training political program to get down in-depth cognition on jQuery on with its respective applications, you canenroll here for live online training with 24/7 support and lifetime entree.

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

How to Run a C Program in Putty in 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 in Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel