Write a program to interchange two variables without using
the third variable?

Answer Posted / vijay r15

using many ways we can
perform
#include<stdio.H>
void main()
{
int a=10,b=20;
b=a+b-(a=b);
//or use a^=b^=a^=b;
//or use a=a+b;b=a-
b;a=a-b;
//or use a^=b; b^=a;
a^=b;
printf("%d%d",a,b);
}

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are types of structure?

595


main() { printf("hello"); fork(); }

684


What is the best way of making my program efficient?

557


What are the advantage of c language?

540


Explain null pointer.

612






What are variables and it what way is it different from constants?

769


What is volatile c?

509


Tell me the use of bit field in c language?

614


Is main is user defined function?

583


When can you use a pointer with a function?

555


What is a loop?

542


write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

3244


What are global variables?

634


Can we access the array using a pointer in c language?

551


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1775