1.

Add Two Numbers Without Using the Addition Operator

Answer»

For the SUM of two numbers, we use the addition (+) operator. In these tricky C programs, we will write a C program to add two numbers without using the addition operator.

#include&LT;stdio.h>#include<stdlib.h>int MAIN(){ int X, y; printf("Enter two number: "); scanf("%d %d",&x,&y); // METHOD 1 printf("%d\n", x-(-y)); // method 2 printf("%d\n", -(-x-y)); // method 3 printf("%d\n", abs(-x-y)); // method 4 printf("%d", x-(~y)-1); return 0;}


Discussion

No Comment Found