Learn about Subtract Two Number Without Using Subtraction Operator in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Subtract Two Number Without Using Subtraction Operator
Program:
#include<stdio.h>
#include<math.h>
int main()
{
int x, y;
printf("Enter two number: ");
scanf("%d %d",&x,&y);
printf("%d", x+(~y)+1);
return 0;
}
Output:
Enter two number: 5 2
3
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Addition of two numbers Using a recursive function in C
Add Two Numbers Without Using the Addition Operator in C