without using arthematic operation ,how can you write the
logic for adding/substraction/multiplication?
Answer Posted / sankar
Without using arthematic operation adding two numbers:
#include<stdio.h>
int main()
{
int a=5,b=6;
while(b)
{
a=a^b;
b=(a^b)&b;
b=b<<1;
}
printf("The sum of a and b is: %d\n",a);
return 0;
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is boolean in java?
What is public static?
Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview
Can we convert stringbuilder to string in java?
What is scope & storage allocation of global and extern variables? Explain with an example
What are packages in java?
Can a main method be overloaded?
What is public static void main?
What is finalize()?
How finally used under exception handling?
This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }
Explain the use of sublass in a java program?
how come we know the object is no more used in the class?
Is Java a dying language?
How to split a string in java?