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 |
increment operateor (++)and decrament(--) #include<stdio.h> #inclide<conio.h> main() { int x=15; while(x!=0) scanf("%d",&x); {
#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4?
Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?
What is the difference between char array and char pointer?
What is spark map function?
write a recursive program in'c'to find whether a given five digit number is a palindrome or not
What is difference between array and pointer in c?
How are structure passing and returning implemented?
What is the condition that is applied with ?: Operator?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
When should a far pointer be used?