Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples C++
 

C++ Swap Numbers


Code ResourceAuthor: bipin_vaylu  

Difficulty Level:

Published: 15th Nov 2007   Read: 5083 times  

Filed in: C++
Add Comment


 


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 Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. Priya11453
2. bipin_vaylu5084
3. chowsys5008
4. raghu.mohindru4429
5. venki_madesh3286
6. vimal.fire2999
7. Subashini2644
8. prabha2484
9. vipin gupta2073
10. Mehedi Shams Rony1830

Active Coders

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape