Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
1 Answers
I know how to swap two variables without using a third variable. Take the first variable as 5 and take the second variable as double of 5 say 10.
Code:
#include<stdio.h>
int main()
{
int a = 5, b = 10;
printf(“Number before swapping: a : %d, b : %d”a,b);
a = a + b;
b = a – b;
a = a – b;
printf(“Number after swapping a:%d, b : %d”,a,b);
