Monday, 16 November 2015

Swaping of "Two Numbers"

Write a C-program to Swap to Numbers using THIRD variable.

Program :

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;

printf("enter the two values for a and b");
scanf("%d%d",&a,&b);

c=a+b;
b=c-b;
a=c-a;
printf("the values of a \n and \n b : \n"a,b);

}



Output:

enter the two values for a and b

a=10, b=20
the values of a
and
b :

a=20,b=10