Write a program to swap two numbers without using third variable. | CODE WITH SHARAD

Write a program to swap two numbers without using third variable.

Written by Sharad Raj on 13th of March, 2018

BASIC PROGRAMS   C LANGUAGE PROGRAMS

PROGRAM CODE

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b;

clrscr();

printf(Enter two numbers : ):

scanf(%d%d,&a,&b);

a=a+b;

b=a-b;

a=a-b;

printf(numbers after swapping are :%d and %d,a,b);

getch();

}


Comments


Contact