Hi Programmers, welcome to new article of c#.net. this article i’ll write the program to Add two numbers without using addition operator in C# Console application. We can easily achieve the output by using AND (&) or OR or Left shift operators. let’s see the codes.

Directly Test Codes into Editor
using System;
namespace ConsoleApp1 {
class Program {
public static int add(int x,int y)
{
int hld;
while(y !=0)
{
hld = x & y;
x = x ^ y;
y = hld << 1;
}
return x;
}
static void Main(string[] args)
{
int a, b, sum;
Console.WriteLine("Enter Two Numbers ");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
sum = add(a, b);
Console.WriteLine("Sum = " + sum);
}
}
}
Happy Coding…Thanks