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

Answer Posted / amar

void main()
{
int a,b;
printf("enter the two numbers");
scanf("%d%d",&a,&b);
a^=b^=a^=b;
printf("%d%d",a,b);//swapped no
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

899


Why does everyone say not to use scanf? What should I use instead?

678


can anyone please tell about the nested interrupts?

1674


What is pointers in c with example?

575


How can you find the day of the week given the date?

610






Difference between Shallow copy and Deep copy?

1564


What are the disadvantages of c language?

614


Explain what is the best way to comment out a section of code that contains comments?

712


Describe the modifier in c?

597


List the variables are used for writing doubly linked list program.

1616


Explain what are the different file extensions involved when programming in c?

629


The difference between printf and fprintf is ?

714


Explain about C function prototype?

601


What is the use of a static variable in c?

587


What is 1d array in c?

598