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

Answer Posted / debasis nayak

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the value of A and B");
scanf("%d %d",&a,&b);
b=(a+b-a=b);
printf("After interchange value are %d %d",a,b);
getch();
}

Is This Answer Correct ?    11 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is function pointer c?

577


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2198


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

619


Do you know the difference between malloc() and calloc() function?

599


What is merge sort in c?

630






Why c is called free form language?

557


Compare array data type to pointer data type

587


What are the different types of control structures?

570


What is data structure in c language?

589


What is meant by preprocessor in c?

522


code for replace tabs with equivalent number of blanks

1625


What extern c means?

525


What is the collection of communication lines and routers called?

600


What do header files do?

593


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

622