26 December 2011

C Program to Swap two numbers without using Temporary variable

3 comments
Program to Swap two numbers without using Temporary variable








#include<stdio.h>
void main()
{
int a,b;
printf("enter two numbers : ");
scanf("%d%d",&a,&b);
printf("number before swapping %d %d",a,b);
a = a+b;
b = a -b;
a = a - b;
printf("\nnumber after swapping %d %d ",a,b);
}

If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

3 comments:

  1. This link might help you .http://www.techycage.com/2014/12/swapping-of-two-numbers-logic.html

    ReplyDelete
  2. best solution of C program to swap two numbers

    http://programmergallery.com/c-program/c-program-swap-two-numbers.php

    ReplyDelete
  3. the link which u r given is error

    ReplyDelete