In this post, we will learn **how to subtract two numbers using C** Programming language.

This program will take two numbers from the user and then compute the difference of those two numbers using simple arithmetic operators.

So, without further ado, let’s begin this tutorial.

**C Program To Subtract Two Numbers**

//C Program To Subtract Two Numbers #include<stdio.h> int main(){ int num1, num2, difference; //Asking for input printf("Enter first number: "); scanf("%d", &num1); printf("Enter second number: "); scanf("%d", &num2); difference = num1 - num2; printf("Difference of %d and %d is: %d", num1, num2, difference); return 0; }

**Output**

```
Enter first number: 18
Enter second number: 7
Difference of 18 and 7 is: 11
```

**How Does This Program Work ?**

int num1, num2, difference;

In this program, we have declared **three int data type** variables named as **num1**, **num2** and **difference**.

//Asking for input printf("Enter first number: "); scanf("%d", &num1); printf("Enter second number: "); scanf("%d", &num2);

Then, the user is asked to enter the value of two numbers.

difference = num1 - num2;

We calculate the difference of two numbers using the **Minus(-)** operator.

printf("Difference of %d and %d is: %d", num1, num2, difference);

Finally, the subtraction result is displayed to the screen using **printf()** function.

**Conclusion**

I hope after going through this post, you understand **how to subtract two numbers using C **Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to help you.

**Also Read:**