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 the use of getch ()?
Explain function?
write a program to concatenation the string using switch case?
Can a void pointer point to a function?
Should I learn data structures in c or python?
What are pointers? What are stacks and queues?
Explain is it valid to address one element beyond the end of an array?
Why is it important to memset a variable, immediately after allocating memory to it ?
Tell us something about keyword 'auto'.
Why do we write return 0 in c?
program for reversing a selected line word by word when multiple lines are given without using strrev
Describe the steps to insert data into a singly linked list.
What are control structures? What are the different types?
What are external variables in c?
What is character set?