write a program to swap Two numbers without using temp variable.
Answers were Sorted based on User's Feedback
Answer / jaspreet singh
no sree although it swap the xalues but when we give the
input as a=32767 n b=1 it will give the wrong answer
Is This Answer Correct ? | 17 Yes | 22 No |
Answer / nagarjun
main()
{
int a=4,b=5;
/*b=(a+b)-(a=b);*/
a^=b^=a^=b;
printf(" \n %d %d \n",a,b);
}
Is This Answer Correct ? | 21 Yes | 28 No |
Answer / naresh
main()
{
int a,b,c;
printf("enter a,b value");
scanf("%d%%d",&a,&b);
c=a^=b^=a^=b;
printf("%d",c);
}
Is This Answer Correct ? | 67 Yes | 150 No |
Answer / yash paranjape
int main()
{
int a,b;
printf("enter the two numbers");
scanf("%d%d",&a,&b);
a^=b^=c^=a;//swap a and b
printf("%d%d",a,b);//numbers r swapped
}
Is This Answer Correct ? | 82 Yes | 189 No |
what is the different bitween abap and abap-hr?
whats the use of header file in c?
Is c is a low level language?
Explain argument and its types.
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement
Write a function in c to find the area of a triangle whose length of three sides is given.
what defference between c and c++ ?
How can I return multiple values from a function?
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
differentiate between const char *a; char *const a; and char const *a;
2 Answers College School Exams Tests, HCL, TCS,
How to write a C program to determine the smallest among three nos using conditional operator?