WAP to swap two numbers without using third variable.

#include <stdio.h>
 #include <stdlib.h>

 int main()
 {
 int a,b;
 printf("enter the first number");
 scanf("%d",&a);
 printf("enter the second number");
 scanf("%d",&b);
a=a+b;
 b=a-b;
 a=a-b;
 printf("first number is %d\n",a);
 printf("second number is %d",b);
 printf("\n");
system("PAUSE");
 }
Advertisements

Leave a comment

Filed under TUTORIALS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s