An Algorithm for swapping the 2 number (using third variable)

  1. START
  2. Input First number as A
  3. Input Second number as B.
  4. Assign temp = A
  5. Assign A=B
  6. Assign B=temp
  7. Print Value of A and B.
  8. END

Flowchart for swapping the 2 number (using third variable)

flowchart for swapping the 2 number
flowchart for swapping the 2 number

C-Code for swapping the 2 number (using third variable))

#include<stdio.h>
void main()
{
int A,B,Temp;
printf("Enter first number as A :");
scanf("%d",&A);
printf("Enter second number as B : ");
scanf("%d",&B);
Temp=A;
A=B;
B=Temp;
printf("After swaping the value of A is %d and B=%d ",A,B);
}