EmbLogic's Blog

Swaping of two number without using third variable.

#include<stdio.h>

int main()

{

int a,b;

printf(“enter the value of a &b”);

scanf(“%d %d”,&a,&b);

printf(“value of a=%d & b=%d\n”,a ,b);

a=a+b;

b=a-b;

a=a-b;

printf(“after swaping a=%d &b=%d\n”, a,b);

return 0;

}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>