# C program to find subtraction of two integer number

In this C program, we are going to read two integers numbers and find subtraction of given numbers.
Submitted by Manju Tomar, on November 07, 2017

Given two integer number and find the subtraction of them using C program.

In this program, we are reading two integer numbers in variable a and b and assigning the subtraction of a and b in the variable sub.

Example 1:

```Input number 1: 40
Input number 2: 45
Output: -5
```

Example 2:

```Input number 1: 45
Input number 2: 40
Output: 5
```

## Program to find subtraction of two numbers in C

```#include<stdio.h>

int main()
{
int a,b,sub;

printf("Enter the first no.: ");
scanf("%d",&a);

printf("Enter the second no.: ");
scanf("%d",&b);

//formula of subtraction
sub= a-b;
printf("subtract is = %d\n", sub);

return 0;
}
```

Output

```First run:
Enter the first no.: 40
Enter the second no.: 45
subtract is = -5

Second run:
Enter the first no.: 45
Enter the second no.: 40
subtract is = 5
```

Since, this is a very simple program for beginners, still you liked the program and its explanation, please share your comments.

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates