can any one plz give me a program to do swapping???
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter two integer to swap\n");
scanf("%d%d,&a,&b");
a=a-b;
b=a-b;
a=a-b;
printf("a=%d\n=%d\n,a,b");
getch();
}
Last edited on
this program is not running
printf("a=%d\n=5d\n,a,b);
You need one var for each placeholder you use, you also need to close your opening "
The return type of main bust be int.
#include <stdio.h>
#include<conio.h>
void main()
{
clrscr();
int x = 10, y = 5;
x = x + y;
y = x - y;
x = x - y;
printf("After Swapping: x = %d, y = %d", x, y);
getch();
}
Last edited on
thankss my friends i have done by this program.