Answers for "write a c program to add two numbers without using addition operator"

1

add two numbers bitwise

public class Bitwise_Addition{
    int add(int a, int b){
        int c;
    while(b!=0){
        c=a&b;
        a=a^b;
        b=c<<1;
        }
    return a;
    }
}
Posted by: Guest on May-03-2020
1

add 2 numbers in c

#include<stdio.h>
int main() {
int a, b, sum;
printf("nEnter two no: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum : %d", sum);
return(0);
Posted by: Guest on December-22-2020

Code answers related to "write a c program to add two numbers without using addition operator"

Browse Popular Code Answers by Language