Write a program to interchange two variables without using
the third variable?

Answer Posted / guest

#include<stdio.h>
void main()
{
int x,y;
printf("enter x and y");
scanf("%d%d",&x,&y);
x=x+y;
y=x-y;
x=x-y;
printf("elements after swapping :%d,%d",x,y);
}

Is This Answer Correct ?    185 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

619


What is the difference between struct and union in C?

554


Why do we use & in c?

580


What is anagram in c?

510


Difference between linking and loading?

683






‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

2364


Is python a c language?

543


Why & is used in c?

698


Explain how can I avoid the abort, retry, fail messages?

581


In C language what is a 'dangling pointer'?

627


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

772


Explain what is the benefit of using #define to declare a constant?

599


What is a void * in c?

587


What are the types of bitwise operator?

654


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

651