### Add Two Numbers Without Plus(+) Operator

**Logic**

1. Take two numbers from user.

2. c = a - ~b -1;

**~ it represents 1's complement.**So the above equation becomes

a-(-b + 1) + 1

a + b – 1 + 1

a + b

#include <stdio.h>

void main()

{

int a,b,c;

printf("Enter two numbers");

scanf("%d%d",&a,&b);

c = a - ~b - 1;

printf("Addition of two numbers is",c);

}

## No comments:

## Post a Comment