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
Write a program to use switch statement.
c language interview questions & answer
What does c mean in basketball?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
What is graph in c?
Why is c called c not d or e?
What is the right type to use for boolean values in c?
Why do we write return 0 in c?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What does main () mean in c?
How do you search data in a data file using random access method?
What is p in text message?
What are different types of variables in c?
What was noalias and what ever happened to it?
What is the difference between far and near in c?