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

write a program that explain #define and # undef directive

1 Answers  


In C language, a variable name cannot contain?

0 Answers  


explain how do you use macro?

0 Answers  


What are file streams?

0 Answers  


Can we access array using pointer in c language?

0 Answers  






Why can't I perform arithmetic on a void* pointer?

0 Answers  


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include<stdio.h>...

0 Answers  


how to find string length wihtout using c function?

6 Answers  


what is difference between ++(*p) and (*p)++

17 Answers   Accenture, HCL, IBM,


What's the right way to use errno?

0 Answers  


What are the types of operators in c?

0 Answers  


What is a constant and types of constants in c?

0 Answers  


Categories