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

Answer Posted / ravi saini

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 ?    119 Yes 66 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can I initialize unions?

792


What are the 5 types of inheritance in c ++?

744


What is meant by errors and debugging?

835


Why main is not a keyword in c?

863


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2385






Explain what are the __date__ and __time__ preprocessor commands?

836


Is swift based on c?

833


Are pointers really faster than arrays?

728


Write a program for finding factorial of a number.

822


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1940


What are the complete rules for header file searching?

837


What does the message "automatic aggregate intialization is an ansi feature" mean?

907


What are the string functions? List some string functions available in c.

778


What are all different types of pointers in c?

754


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

878