Subtraction without '-' operator

source code:

#include<stdio.h>
   int main()
  {
    int a,b;
    int sum;
    printf("Enter any two integers:/n ");
    scanf("%d%d",&a,&b);
       sum = a + ~b + 1;
    printf("Difference of two integers: %d",sum);
       getch();
       return 0;
  }

Comments

Post a Comment

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.