How to swap two values using a single variable ?
condition: Not to use Array and Pointer ?
Answer Posted / ankit anupam
well i think this was wht u were lookin for
#include<stdio.h>
int main()
{
int a, b;
printf("Enter two no");
scanf("%d%d",&a,&b);
printf("a=%d nd b=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d nd b=%d",a,b);
return 0;
}
| Is This Answer Correct ? | 16 Yes | 3 No |
Post New Answer View All Answers
write a program to find out prime number using sieve case?
List some of the static data structures in C?
What is the most efficient way to count the number of bits which are set in an integer?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
How does placing some code lines between the comment symbol help in debugging the code?
How do I swap bytes?
What is the use of putchar function?
How can a process change an environment variable in its caller?
Can true be a variable name in c?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
What are the advantages of union?
What does malloc () calloc () realloc () free () do?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What is the use of gets and puts?
Define the scope of static variables.