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 |
class foo { public: static int func(const char*& p) const; }; This is illegal, why?
I didn't count the ducks that I saw in line, but I do remember that one duck was in front of two ducks, another duck behind two ducks. How many ducks did I see?
What is union and structure?
Write a C function to search a number in the given list of numbers. donot use printf and scanf
WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c file management?
28 Answers 3D PLM, Code Studio, Deltech, IBM,
How can I find out how much memory is available?
Write a program that takes three variables(a,b,c) in as separate parameters and rotates the values stored so that value a goes to b,b,to c and c to a
write a program that finds the factorial of a number using recursion?
c program to compute AREA under integral
What is pointers in c with example?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?