subtraction using bit manupulation

Solutions on MaxInterview for subtraction using bit manupulation by the best coders in the world

showing results for - "subtraction using bit manupulation"
Ahmed
04 Nov 2019
1#include <stdio.h>
2void subs(int i, int j)
3{
4        printf("The Subtraction of the number is : ");
5        while(j != 0)
6        {
7                int borrow;
8                borrow = (~i) & j;
9                i = i^j;
10                j = borrow << 1;
11        }
12        printf("%d", i);
13}
14void main()
15{
16        int i,j,k;
17        printf("Enter the numbers : ");
18        scanf("%d %d", &i, &j);
19        subs(i, j);
20        printf("\n");
21}