can i add two numbers without using arthemetic operators. can any one do it.
vvidyadhara 0 Newbie Poster
Recommended Answers
Jump to PostHint
#include <stdio.h> #include <conio.h> unsigned int add(unsigned int a, unsigned int b) { unsigned int c= 0; unsigned int r= 0; unsigned int t= ~0; for (t= ~0; t; t>>= 1) {r<<= 1; r|= (a^b^c)&1; c= ((a|b)&c|a&b)&1; a>>= 1; b>>= 1;} for (t=~0, c=~t; t; t>>= …
Jump to PostIn order for you to understand the answer to you question you need to know about XOR, AND and SHIFT bitwise operators.
Let's add 3 + 5:integer1 = 3 = 0011b integer2 = 5 = 0101b first operation second operation third operation 0011 0011 shift by …
All 5 Replies
Salem 5,265 Posting Sage

iamthwee
Aia 1,977 Nearly a Posting Maven
amitp49 0 Newbie Poster
karthi.k.s -7 Newbie Poster
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.