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
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
Explain what is output redirection?
What does the error message "DGROUP exceeds 64K" mean?
Explain what is the benefit of using enum to declare a constant?
how to capitalise first letter of each word in a given string?
What is difference between && and & in c?
What is the data segment that is followed by c?
Explain what is wrong with this program statement?
What is the difference between char array and char pointer?
How can you access memory located at a certain address?
Explain how does flowchart help in writing a program?
Difference between constant pointer and pointer to a constant.
Do you know the difference between exit() and _exit() function in c?
Describe the order of precedence with regards to operators in C.