Swap in C Program ( Swap 2 numbers using C Programming )

#include   <stdio.h>


int  main() {

int   firstNumber = 67;

int   secondNumber = 35;

int   temporary;

 

printf( "Swap : \n" );

printf( "\n" );


printf( "Before Swapping : \n" );

printf( "\n" );

printf( "firstNumber = %d \n" , firstNumber);

printf( "secondNumber = %d \n" , secondNumber);

printf( "\n" );


//Swapping

temporary = firstNumber;

firstNumber = secondNumber;

secondNumber = temporary;


printf( "After Swapping : \n" );

printf( "\n" );

printf( "firstNumber = %d \n" , firstNumber);

printf( "secondNumber = %d \n" , secondNumber);

printf( "\n" );


return   0;


}


You may like these posts