We can inter change values with out using third variable.
//This is a program to interchange values of to number without using third variable
#include<stdio.h>
int main()
{
int a,b;
printf("Enter the frist number ");
scanf("%d",&a);
printf("\nEnter the scond number ");
scanf("%d",&b);
a=a*b;
b=a/b;
a=a/b;
printf("\nThe interchanged values are\nThe frist number is %d\nThe scond number is %d\n",a,b);
return 0;
}
The output will be.....
//This is a program to interchange values of to number without using third variable
#include<stdio.h>
int main()
{
int a,b;
printf("Enter the frist number ");
scanf("%d",&a);
printf("\nEnter the scond number ");
scanf("%d",&b);
a=a*b;
b=a/b;
a=a/b;
printf("\nThe interchanged values are\nThe frist number is %d\nThe scond number is %d\n",a,b);
return 0;
}
The output will be.....
good program
ReplyDeleteNice way
ReplyDelete