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
Differentiate fundamental data types and derived data types in C.
Write a program in c to replace any vowel in a string with z?
What is mean by data types in c?
Write a program of prime number using recursion.
What are the different types of errors?
What are header files why are they important?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
What is the difference between arrays and pointers?
Stimulate calculator using Switch-case-default statement for two numbers
Explain how can I pad a string to a known length?
Difference between Shallow copy and Deep copy?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
what are the 10 different models of writing an addition program in C language?
How can I delete a file?