Code.GeekInterview.com
 
Code Samples C++
 

C++ Swap Numbers


Code ResourceAuthor: bipin_vaylu  

Difficulty Level:

Published: 15th Nov 2007   Read: 13568 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. Priya36642
2. chowsys14935
3. bipin_vaylu13569
4. raghu.mohindru8712
5. Subashini7226
6. vimal.fire6967
7. rachittyagi6616
8. venki_madesh6200
9. prabha6187
10. vipin gupta5897

Active Coders

Refined Tags