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

Differentiate between Macro and ordinary definition.

723


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1245


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1113


Write a program to check prime number in c programming?

594


Explain how can you determine the size of an allocated portion of memory?

616






What is the use of a conditional inclusion statement in C?

595


What is file in c language?

574


What is modeling?

642


What does c mean in basketball?

561


How many keywords are there in c?

586


What is strcpy() function?

652


can we change the default calling convention in c if yes than how.........?

2030


Which is best linux os?

558


Write a c program to demonstrate character and string constants?

1678


Explain union.

633