swap two number wthout using third variable
Answers were Sorted based on User's Feedback
Answer / jvhariharan
void main()
{
int a=10,b=20;
a=a+b;
b=a-b;
a=a-b;
}
| Is This Answer Correct ? | 24 Yes | 3 No |
Answer / ashutosh tiwari
void swap_num(int *a, int *b)
{
*a = *a+*b; *b = *a-*b; *a = *a-*b;
}
or
void swap_num(int *a,int *b)
{
*a = *a^*b; *b = *a^*b; *a = *a^*b;
}
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / suyog
A very simple and cute answer...
Assign as follows
a=a+b-(b=a)
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / abhay khare
void main()
{
int a,b,c
printf("two no are\n");
scanf("%d&n");
a=c;
b=a
c=b
getch;
}
| Is This Answer Correct ? | 1 Yes | 10 No |
if 3 duplicate records, by keeping one original and one duplicate record, and how to delete remaining 2 duplicates in sql server 2008
if heap sort contains n elements, no of comparsions required are
What is test execution and when will we start execution please send me one example for this question
how to convert infix expression to prefix expression?
what is session state?
how to data grid use in data bind?
What is the GAC? What problem does it solve?
what is throws keyword
What is diffrent between Method and and function in c#
What are events in smartforms?
what is polymorphism in java.
how to run servlets in eclipse 3.3.2....if we choose file->new->servlet then after that it is showing javax.servlet.* ...cannot be resolved.......to avoid this error any external jar file is to be added? please help me regarding this issue........thank u