WELCOME

Welcome to KoDes4U

Pages

Friday, February 25, 2011

swapping numbers(c programs)



/*Write a C program to swap two numbers without using third variable
  Coded by koDes4U,blogspot.com*/
#include<stdio.h>
#include<conio.h>
void main()
{
 int a=4,b=6;
 clrscr();
 printf("\nBefore swaping a=%d\tb=%d",a,b);
 a=a+b;
 b=a-b;
 a=a-b;
 printf("\nAfter swaping a=%d\tb=%d",a,b);
 getch();
}

No comments:

Post a Comment