Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Thursday 28 March 2019

To find sum of two numbers without using any operator

Write a program to find the sum of positive integers without using any operator.


C program:


#include<stdio.h>

int add(int x, int y)
{
    return printf("%*c%*c", x, ' ', y, ' ');
}

int main()
{
    printf("Sum = %d", add(3, 4));

    return 0;
}

Output:

Sum = 7

0 comments:

Post a Comment