Adding two numbers without using + Operator



 

 Adding two numbers without using + Operator

 

int add(int x, int y)
{
    return printf("%*c%*c",  x, '\r',  y, '\r');
}
 
int main()
{
    printf("Sum = %d", add(3, 4));
    return 0;
}
Output:
Sum = 7

#include<stdio.h>
#include<conio.h>
 
void main()
{
int a=10,b=5,i;
clrscr();
 
while(b>0)
  {
  a++;
  b--;
  }
printf("%d",a);
getch();
}

#include<stdio.h>
#include<conio.h>
 
void main()
{
int a=10,b=5;
while(b--)
   a++;
printf("Sum is : %d" a);
}

#include<stdio.h>
#include<conio.h>
 
void main()
{
int a=10,b=5;
a = a-(-b);
printf("Sum is : %d" a);
}



SHARE

About df

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment