SWAPPING TO NUMBERS WITHOUT TAKING ANY TEMPORARY VARIABLE
/*We generally swap or interchange to variables by taking a temporary variable.Here is a simple program for swapping to numbers without using any intermediate variable*/
Language=C
#include<stdio.h>
int main()
{
int a,b;
printf( "Enter the value of a and b=" );
scanf( "%d%d",&a,&b );
printf( "a and b before swapping\n" );
printf( "%d %d\n",a,b );
a = a+b;
b = a-b;
a = a-b;
printf( "a and b after swapping\n" );
printf( "%d %d\n",a,b );
return 0;
}
Wednesday 3 August 2016
Subscribe to:
Post Comments (Atom)
Kruskal Algorithm
Minimum Cost Spanning Tree By Kruskal Algorithm using priority_queue in c++ #include<bits/stdc++.h> using namespace std; typedef p...
-
Using Divide And Conqure Technique finding maximum and minimum value of an array Language C++ /************ done! ************/ #inc...
-
LINKED LIST
-
CODEFORCES 709A-Juicer Solution #include<iostream> using namespace std ; int main ( ) { int n , b , d ; ...
No comments:
Post a Comment