Write a program to swap two numbers using pre-processor.

Written by Sharad Raj on 13th of March, 2018

BASIC PROGRAMS   C LANGUAGE PROGRAMS

PROGRAM CODE

#include<stdio.h>
#include<conio.h>

#define SWAP(a,b) {a=a+b;b=a-b;a=a-b;}

void main()

{

int x,y;

clrscr();

printf(enter any two numbers : );

scnaf(%d%d,&x,&y);

printf(numbers before swapping were %d and %d,x,y);

SWAP(x,y);

printf(“\n numbers after swapping are : %d and %d,x,y);

getch();

}