C Program to subtract two number without using minus operator:
Lets do some magic, today we will see that how to subtract two number without using subtracter operator in c.
ALGORITHM:-
step 1 : Start
step 2 : Enter any two number
step 3 : Add one variable two second with the ~ symbol and add 1.
step 4 : Display the result
step 5 : Stop
PROGRAM CODE:-
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y;
int sum;
printf("Enter any two integers: ");
scanf("%d%d", &x, &y);
sum = x + ~y + 1;
printf("Subtraction of two integers: %d", sum);
getch();
}
OUTPUT:-
Enter any two integers: 8
5
subtraction of two integers: 3
C Program Subtracter one integer from another without using minus operator How to subtracter a number in c without using minus operator subtraction using ~(teils) symbol
ConversionConversion EmoticonEmoticon