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

Answer Posted / sree

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter two numbers");
scanf("%d %d",&a &b);
a=a+b;
b=a-b;
a=a-b;
printf("The swapped values are:");
printf("a:%d",a);
printf("b:%d",b);
getch();
}

Is This Answer Correct ?    73 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an expression?

825


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

940


What is storage class?

834


If errno contains a nonzero number, is there an error?

1008


Is c easier than java?

765






Can we use any name in place of argv and argc as command line arguments?

801


Explain what will the preprocessor do for a program?

778


How can you find the day of the week given the date?

812


Difference between malloc() and calloc() function?

853


What are the different types of C instructions?

941


What is variables in c?

790


How do I get an accurate error status return from system on ms-dos?

842


What is the use of sizeof?

737


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1066


What are # preprocessor operator in c?

834