write a program to swap Two numbers without using temp variable.
Answer Posted / harisharumalla
#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 ? | 604 Yes | 119 No |
Post New Answer View All Answers
what is the basis for selection of arrays or pointers as data structure in a program
Which is best linux os?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is return in c programming?
How is a null pointer different from a dangling pointer?
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.
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
write a program to generate address labels using structures?
Why do we use return in c?
How do shell structures work?
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
Write a program to identify if a given binary tree is balanced or not.
Why is c known as a mother language?
What are the two forms of #include directive?
Do you know pointer in c?