Search This Blog

Loading...

Add Two Numbers without using the Plus Operator in C


#include<stdio.h>

int main(){
   
    int a,b;
    int sum;
    clrscr();

    printf("Enter any two integers: ");
    scanf("%d%d",&a,&b);

    //sum = a - (-b);
    sum = a - ~b -1;

    printf("Sum of two integers: %d",sum);
    getch();
}

No comments:

Post a Comment