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

Answer Posted / dally

#include<stdio.h>
int main()
{
int a,b;
printf("Enter values for a,b\n");
scanf("%d %d",&a,&b);

b = b+a;
a= b-a;
b=b-a;
printf("a = %d,b = %d",a,b);

}

Is This Answer Correct ?    18 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of operators are there in c?

784


Explain that why C is procedural?

871


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

859


Is it better to use malloc() or calloc()?

823


What is the difference between mpi and openmp?

957






What are the features of c language?

800


What does %c mean in c?

828


Write a C program in Fibonacci series.

815


Explain built-in function?

798


What is the difference between memcpy and memmove?

761


What are the types of assignment statements?

808


explain what is a newline escape sequence?

851


Differentiate between full, complete & perfect binary trees.

848


What is the use of define in c?

778


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

835