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
Explain what is the difference between functions getch() and getche()?
Write a program to check prime number in c programming?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
How can I find out if there are characters available for reading?
Wt are the Buses in C Language
Can you return null in c?
What are the different types of linkage exist in c?
What is operator precedence?
What are c identifiers?
What are the different types of errors?
Is null valid for pointers to functions?
Explain what is dynamic data structure?
Where in memory are my variables stored?
What is an lvalue?
Can we change the value of static variable in c?