#include <stdio.h>
#include <conio.h>
void main()
{
float firstNumber, secondNumber, temporaryVariable;
printf("Enter first number: ");
scanf("%f", &firstNumber);
printf("Enter second number: ");
scanf("%f",&secondNumber);
// Value of firstNumber is assigned to temporaryVariable
temporaryVariable = firstNumber;
// Value of secondNumber is assigned to firstNumber
firstNumber = secondNumber;
// Value of temporaryVariable (which contains the initial value of firstNumber) is assigned to secondNumber
secondNumber = temporaryVariable;
printf("\nAfter swapping, firstNumber = %f\n", firstNumber);
printf("After swapping, secondNumber = %f", secondNumber);
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.