Q1:Write a C program to "interchange" values without using third variable?
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
//interchange number
int a=4;
int b=5;
clrscr();
printf("\na=%d",a);
printf("\nb=%d",b);
b=a+b;
a=b-a;
b=b-a;
printf("\nAfter interchanging ");
printf("\na=%d",a);
printf("\nb=%d ",b);
getch();
}
***********************************************************************************
Sample Output:
Comments
Post a Comment
Thanks for the comment and don't forget to subscribe.