C Program Write a Program to Swap a Two Number
Menu
Turn Mobile View Off
by Dinesh Thakur

In this program the two numbers to be swapped from each other place with the use of third variable. In program the variables declare for storing the value in it. Here three variables are also declared (a,b,c) the use of only two numbers the swapping will happen. The first number shifted to third variable and then to other variable the reverse phase will be on the move to swap both numbers. And other functionality also comes in light for displaying the result on the screen.

Problem Statement:
This is C Program to Swap Two Numbers Using Third variable.

  1. Declaring variable.
  2. Using swap condition.
  3. Display result on the screen.

Here is source code of the C program to Swap a Two Number. The C program is successfully compiled. The program output is also shown below. 

#include<stdio.h>
main()
{
int a,b,c;
clrscr();
printf("enter the two value");
scanf("%d%d",&a,&b);
c=a;
a=b;
b=c;
printf("%d\n%d",a,b);
getch();
}
 Swap a Two Number
Dinesh Thakur is a Technology Columinist and founder of Computer Notes and Technology Motivation. Turn Mobile View Off