write a program to swap two numbers without using temporary
variable?
Answer Posted / guest
[code]
main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a+b; b=a-b; a=a-b; // This is first way.
a =a*b; b=a/b; a=a/b;
printf("a = %d\nb = %d\n",a,b);
}
[/code]
[code]
main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a*b; b=a/b; a=a/b; //This is second way
printf("a = %d\nb = %d\n",a,b);
}
[/code]
Is This Answer Correct ? | 19 Yes | 2 No |
Post New Answer View All Answers
What is a macro, and explain how do you use it?
What is the best way to comment out a section of code that contains comments?
What is f'n in math?
What is return in c programming?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
write a program to rearrange the array such way that all even elements should come first and next come odd
Is main is user defined function?
What are the types of pointers?
What is the difference between constant pointer and constant variable?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
How does #define work?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
Where does the name "C" come from, anyway?
What does p mean in physics?
explain what is fifo?