To find sum of two numbers without using any operator

Write a program to find the sum of two numbers without using any operator.

Example:

Input:  num1 =5 num2= 10
Output:                Sum is 15 

Approach

C

#include <stdio.h>

int addNumbers(int xint y)
{
    return printf("%*c%*c"x' 'y' ');
}

int main()
{
    int num1 = 5num2 = 10;

    int sum = addNumbers(num1num2);

    printf("Sum is %d "sum);
    return 0;
}


No comments:

Post a Comment