SIr,

I wanted to know the C Statement for adding two numbers without using + sign..

Anyone can help me to solve this.....

ThanQ

Try

int a = b - -c;

Stop the course which asks silly questions like this.

commented: Cute Trick [Grunt] +1
commented: LOL - the old favourites are the best - Salem +1

how about std::accumulate?
There won't be + operator insight ;)

> how about std::accumulate?
Don't remember this C statement :)

How would you do it on paper? Imagine you're back at infants school where they teach you how to add up using columns of hundreds/tens/units with a carrier at the bottom.

In an equally pointless vein

// a = a + b
while ( b-- ) a++;

OK, so there are some side effects, and a bug or two ;)

> I wanted to know the C Statement for adding two numbers without using + sign..
Study what exclusive-or and bitwise-and give you for a single pair of bits.
Hint: exclusive-or adds two bits without carry.
That's all I'm saying without giving the whole game away, and that's probably too much anyway.

commented: Nice-[Grunt] +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.