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? Explain what are bus errors, memory faults, and core dumps?

741


how to count no of words,characters,lines in a paragraph.

3914


What is a dynamic array in c?

604


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1529


How can a string be converted to a number?

527






What are the disadvantages of a shell structure?

703


Are pointers integers in c?

619


Is the exit() function same as the return statement? Explain.

674


How was c created?

601


What's a good way to check for "close enough" floating-point equality?

636


I have seen function declarations that look like this

610


In which layer of the network datastructure format change is done

1446


Write a C program to count the number of email on text

1428


Can we replace the struct function in tree syntax with a union?

792


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

656