SIr,
I wanted to know the C Statement for adding two numbers without using + sign..
Anyone can help me to solve this.....
ThanQ
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.
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.