Code.GeekInterview.com
 
Code Samples C++
 

C++ Swap Numbers


Code ResourceAuthor: bipin_vaylu  

Difficulty Level:

Published: 15th Nov 2007   Read: 13578 times  

Filed in: C++
Add Comment


 

 

Sponsored Links


 

 

Swap Two No.s Without Using Third No. Copy This Code Into Notepad and save with extesion .c then run in c editor.

 


Sample Code
  1. /* Swap Two No.s */
  2. #include<stdio.h>
  3. #include<conio.h>
  4.  
  5. void main()
  6. {
  7.     int no1,no2;
  8.     clrscr();
  9.     printf("Enter First No::");
  10.     scanf("%d",&no1);
  11.     printf("Enter Second No::");
  12.     scanf("%d",&no2);
  13.     printf("Before Swapping n First No=%dtSecond No=%d",no1,no2);
  14.     no1=no1+no2;
  15.     no2=no1-no2;
  16.     no1=no1-no2;
  17.     printf("After Swapping n First No=%dtSecond No=%d",no1,no2);
  18.     getch();
  19.     return 0;
  20. }
  21. ?>
Copyright GeekInterview.com


Next Article: Armstrong Number


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    



Popular Coders

# Coder NameHits
1. Priya36670
2. chowsys14957
3. bipin_vaylu13579
4. raghu.mohindru8719
5. Subashini7235
6. vimal.fire6980
7. rachittyagi6627
8. venki_madesh6208
9. prabha6193
10. vipin gupta5907

Active Coders

Refined Tags