c program to swap the value of two numbers using macro,
c swapping program using Micro
#include
#include
#define S1 no1
#define S2 no2
#define SWP (S1+S2)
#define B (SWP-S2)
#define A (SWP-S1)
void main()
{
int no1,no2;
clrscr();
printf("\nEnter the first number=");
scanf("%d",&no1);
printf("\nEnter the second number=");
scanf("%d",&no2);
printf("\n\nYou entered value is= %d and %d", no1,no2);
printf("\n\nAfter swapping value is= %d and %d ",A,B);
getch();
}
#include
#include
#define S1 no1
#define S2 no2
#define SWP (S1+S2)
#define B (SWP-S2)
#define A (SWP-S1)
void main()
{
int no1,no2;
clrscr();
printf("\nEnter the first number=");
scanf("%d",&no1);
printf("\nEnter the second number=");
scanf("%d",&no2);
printf("\n\nYou entered value is= %d and %d", no1,no2);
printf("\n\nAfter swapping value is= %d and %d ",A,B);
getch();
}