GeekInterview
|
Geeks Forum
|
Online Quiz
|
Learning Center
|
Privacy
|
Terms and Conditions
|
Contact
Home
>
Code Samples
>
C/C++
> Swaping two variables without using 3rd variable
Swaping two variables without using 3rd variable
Description:
It is a program written by using 'C' language, The objective of this program is to swap two variables without using 3rd Variable
Date added:
11 September, 2007
Submitted By:
meefriend4ever
Rating:
0
Download:
N/A
Instructions:
The code is self explanatory
Source Code:
#include
void main() { int a,b; printf("any 2 numbers"); scanf("%d,%d",&a,&b); a=a^b; b=a^b; a=a^b; printf("after swaping"); printf("%4d,%5d",a,b); }
WidgetBucks - Trend Watch - WidgetBucks.com
Comments
[
Leave Comment
]
Your name:
E-mail (optional):
Text:
Please enter code
shown on image:
Posted by
jagatsastry
at 22 October, 2007
proper one but the title should have been "swapping two integers(or characters) without using a temp vbl". This method cant be used with floating point numbers.
Tips
[
Leave Tip
]
Your name:
E-mail (optional):
Text:
Please enter code
shown on image:
No tips added yet. Be the first one to share tip.
Reviews
[
Leave Review
]
Your name:
E-mail (optional):
Rate:
1
2
3
4
5
6
7
8
9
10
Text:
Please enter code
shown on image:
No reviews added yet. Be the first one to review.
Tags
code
Related Categories
Oracle » Database » C/C++
DB2 » Database » C/C++
Code Samples » C/C++
SQL Server » Database » C/C++
MYSQL » Database » C/C++
Copyright @
GeekInterview.com