write a program to swap Two numbers without using temp variable.
Answer Posted / romeld
#include<stdio.h>
main()
{
int a,b;
printf("enter the value of a and b\n");
scanf("%d%d",&a,&b);
printf("before swapping\na=%d\nb=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping\na=%d\nb=%d\n",a,b);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain modulus operator.
What is the difference between exit() and _exit() function in c?
What does sizeof int return?
Why can arithmetic operations not be performed on void pointers?
What is 2 d array in c?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
What is function what are the types of function?
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
What is wrong with this statement? Myname = 'robin';
Why clrscr is used after variable declaration?
Write a program to show the change in position of a cursor using c
What is the 'named constructor idiom'?
Tell me the use of bit field in c language?
How can I call a function with an argument list built up at run time?
What is structure pointer in c?