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 |
What is mean by data types in c?
How can you increase the size of a statically allocated array?
what is diff b/w huge & far & near pointer??
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
how to swap 2 numbers within a single statement?
Explain the concept and use of type void.
Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);
How can a program be made to print the line number where an error occurs?
What is a string?
Why do we use stdio h and conio h?
int *a[5] refers to
declare afunction pointer to int printf(char *)?