swap two integer variables without using a third temporary
variable?

Answer Posted / sidhartha

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\n ENTER 2 VALUES : ");
scanf("%d%d",&a,&b);
printf("\n THE VALUES BEFORE SORTING : %d,%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\n THE VALUES AFTER SORTING : %d,%d",a,b);
getch();
}

Is This Answer Correct ?    40 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of c language?

539


Differentiate abs() function from fabs() function.

586


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1914


What is signed and unsigned?

627


What is ambagious result in C? explain with an example.

2039






What is #define used for in c?

601


Is main is user defined function?

582


Is c++ based on c?

640


What is bash c?

544


Place the #include statement must be written in the program?

555


What is maximum size of array in c?

569


What are the different types of constants?

629


What is the use of getchar() function?

617


Can you return null in c?

584


a value that does not change during program execution a) variabe b) argument c) parameter d) none

678