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 |
How can I access memory located at a certain address?
What does 4d mean in c?
What is difference between structure and union?
Write a c program to print the sizes and ranges of different data types in c?
Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.
What are the advantages and disadvantages of a heap?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
1 What is a Data Structure?
An interactive c program to read basic salary of 15 persons. each person gets 25% of basic as HRA, 15%of basic as conveyance allowances, 10%of basic as entertainment allowances.The total salary is calculated by adding basic+HRA+CA+EA.Calculate how many out of 15 get salary above 10,000.Rs also print the salary of each employee
Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed once 'a' prints and if it is pressed two times 'b' prints and so on.we have to print all the alphabets as on mobile phone like this.
Here is a good puzzle: how do you write a program which produces its own source code as output?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)