how to add two numbers without using arithmetic operators?
Answers were Sorted based on User's Feedback
Answer / sanjay bhosale
int x=12382,y=2;
int xor, and, temp;
and = x & y;
xor = x ^ y;
while(and != 0 )
{
and <<= 1;
temp = xor ^ and;
and &= xor;
xor = temp;
}
printf(" sum is : %d",xor);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shashishekar
#include<stdio.h>
#include<conio.h>
int main()
{
int a= 10;
int b=5;
int sum=0;
sum= a-(~b)-1;
printf(" sum= %d",sum);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / mallikarjun
#include<stdio.h>
#include<conio.h>
main()
{
int a= 10;
int b=5;
sum=0;
sum= a&&b;
printf(" sum= %d",sum);
}
| Is This Answer Correct ? | 9 Yes | 10 No |
Answer / rajkumar
#include<stdio.h>
#include<conio.h>
void main()
{
int a=6,b=3,sum=0;
sum=a^b;
printf("sum=%d",sum);
getch();
}
| Is This Answer Correct ? | 3 Yes | 9 No |
c program to manipulate x=1!+2!+3!+...+n! using recursion
What is null pointer constant?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
0 Answers Amdocs, Apps Associates,
What is the difference between %d and %*d in C
Why static variable is used in c?
what is the code for getting the output as * ** ***
difference between semaphores and mutex?
Is c is a low level language?
What is the difference between a free-standing and a hosted environment?
main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output?
What is binary tree in c?
Program to find the absolute value of given integer using Conditional Operators