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
Why main function is special give two reasons?
What is c token?
c program to compute AREA under integral
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is string function in c?
What is typedef example?
What is the concatenation operator?
What is the data segment that is followed by c?
Explain the bubble sort algorithm.
How variables are declared in c?
What is default value of global variable in c?
What is malloc() function?
How many identifiers are there in c?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What does %2f mean in c?