/* EXCHANGE THE INTEGER VALUE WITHOUT USING THE THIRD VARIABLE */
#include<stdio.h>
void main()
{
int a,b;
printf("enter the two integer variabe \n");
scanf("%d,%d",&a,&b);
//exchange the value of a to b ,b to a without using third variable
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
getch();
}
/*EXAMPLE: A=3,B=10
A=A+B; // A=3+10=13
B=A-B; //B=3-10=3
A=A-B //A=13-3=10 */
shashikumar s g 15 Light Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
shashikumar s g 15 Light Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
rithish 13 Junior Poster in Training
rithish 13 Junior Poster in Training
WaltP commented: No, he's exchanging. Read the thread AND the code he posted. -3
thewebhostingdi -7 Junior Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shashikumar s g 15 Light Poster
shashikumar s g 15 Light Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shashikumar s g 15 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.