write a program in C to swap two variables

Answer Posted / srinivas

#include <stdio.h>

int main(void)
{
int a = 2, b = 5;

a = a + b;
b = a - b;
a = a - b;
printf("%d\t%d\n", a, b);
return 0;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ponter?

775


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

726


How do I get an accurate error status return from system on ms-dos?

650


Why doesnt that code work?

603


How many types of operator or there in c?

605






What is hungarian notation? Is it worthwhile?

700


What is mean by data types in c?

554


Stimulate calculator using Switch-case-default statement for two numbers

2449


What are header files in c programming?

658


application attempts to perform an operation?

1496


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

1420


Explain what does the format %10.2 mean when included in a printf statement?

783


What is the purpose of macro in C language?

664


What is dynamic dispatch in c++?

559


What is scope rule in c?

608