write a program to swap Two numbers without using temp variable.
Answer Posted / ajith c.k
#include"stdio.h"
int swap(int *,int*);
int main()
{
int a,b;
printf("enter two number");
scanf("%d%d",&a,&b);
swap(&a,&b);
printf("%d\t%d",a,b);
return ;
}
int swap(int *s,int *q)
{
if(*s==*q)
return;
*s^=*q;
*q^=*s;
*s^=*q;
return ;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How important is structure in life?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What is the basic structure of c?
What is pointers in c with example?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
Dont ansi function prototypes render lint obsolete?
What is a structure in c language. how to initialise a structure in c?
List some applications of c programming language?
What is a sequential access file?
What is data structure in c and its types?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
What is return in c programming?
What is page thrashing?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2