write a program to swap Two numbers without using temp variable.
Answers were Sorted based on User's Feedback
Answer / jaspreet singh
no sree although it swap the xalues but when we give the
input as a=32767 n b=1 it will give the wrong answer
| Is This Answer Correct ? | 17 Yes | 22 No |
Answer / nagarjun
main()
{
int a=4,b=5;
/*b=(a+b)-(a=b);*/
a^=b^=a^=b;
printf(" \n %d %d \n",a,b);
}
| Is This Answer Correct ? | 21 Yes | 28 No |
Answer / naresh
main()
{
int a,b,c;
printf("enter a,b value");
scanf("%d%%d",&a,&b);
c=a^=b^=a^=b;
printf("%d",c);
}
| Is This Answer Correct ? | 67 Yes | 150 No |
Answer / yash paranjape
int main()
{
int a,b;
printf("enter the two numbers");
scanf("%d%d",&a,&b);
a^=b^=c^=a;//swap a and b
printf("%d%d",a,b);//numbers r swapped
}
| Is This Answer Correct ? | 82 Yes | 189 No |
how can I convert a string to a number?
what is difference b/w extern & volatile variable??
What is the use of parallelize in spark?
Why c++ is called c++ and not c+?
Using which language Test cases are added in .ptu file of RTRT unit testing???
#include<std.h> int main() { char *str[]={"Frogs","Do","Not","Die","They","Croak!"}; printf("%d %d\n",sizeof(str),strlen(str)); ...return 0; } what will the output of the above program?
#include<stdio.h> void main() { int a [5]; for (i=0; i<=4; i++) printf(ā%dā ,a[i]); }
Explain what is a stream?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function.
#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean?