write a program to swap Two numbers without using temp variable.

Answer Posted / kabita shah

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int x,y;
printf("enter two value");
scanf("%d%d",&x,&y);
x=x+y;
y=x-y;
x=x-y;
printf("value of x=%d",x);
printf("value of y=%d",y);
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data type long in c?

621


Write a simple code fragment that will check if a number is positive or negative.

704


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

899


while initialization of array why we use a[][2] why not a[2][]...?

1862


What is the difference between printf and scanf in c?

745






How can I read a binary data file properly?

632


What are the benefits of organizational structure?

568


What is the difference between far and near ?

678


Suggesting that there can be 62 seconds in a minute?

594


What is pointer & why it is used?

600


writ a program to compare using strcmp VIVA and viva with its output.

1519


Explain what is the difference between the expression '++a' and 'a++'?

624


What is meant by high-order and low-order bytes?

650


what is the syallabus of computer science students in group- 1?

1836


How can I find out how much free space is available on disk?

624