Program to input two number and print their values after interchange(Swap) without using third value.

/* Program to swap two number in C */
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter first number=");
scanf("%d",&a);
printf("Enter second number=");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("\nFirst number=%d",a);
printf("\nSecond number=%d",b);
getch();
}

OUTPUT 







Note:If any problems in this program please comment and never forget to Share.
Follow for recently updates.


Comments

Popular posts from this blog

Write a program to input age of any person and check he is eligible for voting or not.

Write a program to input two digit number and check number is palindrome or not.

Write a program to input speed of Royal Enfield and check it's running at economic speed or not.