#include<stdio.h>
#include<conio.h> Program in c to swap the value of two no’s without using third variable
void main()
{
int a,b;
clrscr();
printf(“
input two variable a and b:\n”);
scanf(“%d%d”,&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf(“swap
of value\na=%d\nb=%d”,a,b);
getch();
}
output:
input two variables a and
b:
7
9
swap of value
a=9
b=7
No comments:
Post a Comment