Swap Two Variable using Temp variable


C Program to Swapping two data using call By call By value technique. c program to swap using call by value:

This c program demonstrate. how the two number are swapped. This swapping of variables are done in function ‘swap’ which we have defined. Swapping c program clears the concept, that how call by value implemented.

ALGORITHM:-

step 1 : start
step 2 : Input two number
step 3 : Interchange those value using third variable
step 4 : Stop Execution


PROGRAM CODE:-

#include<stdio.h>
#include<stdio.h>
void main( )
{
    int a = 10, b = 20, t ;         
    printf("value befor swapping:");
    printf ( "na = %d b = %d", a, b ) ; 
    t = x ;
    x = y ;
    y = t ; 
    printf("value after swapping:");
    printf ( "nx = %d y = %d", x, y ) ;
    getch();
}


OUTPUT:-

value before swapping
a = 10, b = 20

value after swapping
a = 20, b=10
C Program to swap two number without third variable
C Program To Convert number into ASCII Code
how to convert number in ASCII code
ASCII Code Conversion to number