j

Saturday, 7 November 2015

Write a program that take valuse of a and b then enterchange their values without using extra variable

PROGRAM SOLUTION

#include<stdio.h>
#include<conio.h>
void mian()
{
clrscr();
int a,b;
printf("Enter the value of a and b :: ");
scanf("%d%d",&a,&b);
printf("The value of a before change :: %d\n",a);
printf("The value of b before change :: %d\n",b);
a=a+b;
b=a-b;
a=a-b;
printf("The value of a after change :: %d\n",a);
printf("The value of b after change :: %d\n",b);
getch();
}


OUTPUT

Subscribe to this Blog via Email :