write a program to swap Two numbers without using temp variable.
Answer Posted / amit chauhan
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter the 2 numbers");
scanf("%d%d",&a,&b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
/* or
a=a*b;
b=a/b;
a=a/b;
*/
printf("\n A = %d \n B = %d\n");
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is void a keyword in c?
What is the heap?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Is main is a keyword in c?
What is bubble sort in c?
How do you determine whether to use a stream function or a low-level function?
What is a built-in function in C?
What is graph in c?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Who is the main contributor in designing the c language after dennis ritchie?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
How many levels deep can include files be nested?
What is the difference between Printf(..) and sprint(...) ?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
What are loops c?