How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / gana samantula
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(" Enter the first No.:");
scanf("%d",&a);
printf(" Enter the second No.:");
scanf("%d",&b);
b=a+b-(a=b);
printf(" the swap of a and b numbers :%d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What is a method in c?
What is formal argument?
provide an example of the Group by clause, when would you use this clause
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is time complexity c?
What is the meaning of && in c?
What is array of pointers to string?
How can you draw circles in C?
How many bytes are occupied by near, far and huge pointers (dos)?
Explain what header files do I need in order to define the standard library functions I use?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
Explain what is the benefit of using an enum rather than a #define constant?
Can we use visual studio for c?
Can you please explain the difference between strcpy() and memcpy() function?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }