write a program to swap Two numbers without using temp variable.

Answers were Sorted based on User's Feedback



write a program to swap Two numbers without using temp variable...

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

write a program to swap Two numbers without using temp variable...

Answer / tamerat

q

Is This Answer Correct ?    8 Yes 13 No

write a program to swap Two numbers without using temp variable...

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

write a program to swap Two numbers without using temp variable...

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

write a program to swap Two numbers without using temp variable...

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

Post New Answer

More C Interview Questions

what is the different bitween abap and abap-hr?

0 Answers   TCS,


whats the use of header file in c?

2 Answers  


Is c is a low level language?

0 Answers  


Explain argument and its types.

0 Answers  


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  






get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement

3 Answers  


Write a function in c to find the area of a triangle whose length of three sides is given.

2 Answers  


what defference between c and c++ ?

6 Answers  


How can I return multiple values from a function?

6 Answers  


Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d

1 Answers   TCS,


differentiate between const char *a; char *const a; and char const *a;

2 Answers   College School Exams Tests, HCL, TCS,


How to write a C program to determine the smallest among three nos using conditional operator?

2 Answers   Google,


Categories