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

Answer Posted / anantha

b=a+b
a=b-a
b=b-a

if a=3 and b=5
then now b=a+b=8
and a=8-a=8-3=5,now a=5
b=8-a=8-5=3,now b=3

so, a=5 and b=3

Is This Answer Correct ?    198 Yes 59 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

2080


differentiate built-in functions and user – defined functions.

844


What is the difference between #include

and #include “header file”?

755


what are bit fields in c?

1149


Why do we use namespace feature?

791






Who is the main contributor in designing the c language after dennis ritchie?

747


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

745


What are the advantages and disadvantages of c language?

748


What are the data types present in c?

820


What is data structure in c language?

815


program to convert a integer to string in c language'

2170


Which is an example of a structural homology?

1018


What are different storage class specifiers in c?

830


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1730


What is malloc return c?

767