C Program to swap two variables using multiply and division operation without using temporary variable

Swapping two variables using multiplication and division in such a way that values get interchanged by following method: $$a = a * b$$ $$b = a / b$$ $$a = a / b$$ The values 'a' and 'b' are printed after swapping.

Program

#include<stdio.h>
void main()
{
	int a, b;
	printf("Enter the value of a and b\n");
	scanf("%d %d", &a, &b);
	printf("Values before swapping:\n");
	printf("a:\t%d\nb:\t%d\n", a, b);
	a = a * b;
	b = a / b;
	a = a / b;
	printf("Values after swapping:\n");
	printf("a:\t%d\nb:\t%d\n", a, b);
}

Output

Enter the value of a and b
65
23
Values before swapping:
a:	65
b:	23
Values after swapping:
a:	23
b:	65