Compare and contrast the code you posted with the following. Note the use of == instead of =, that is what anduril462 is probably looking at:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int num1, num2, rem, x, y;
printf ("This program calculates the GCD of two numbers.\n");
printf ("Enter the first number: ");
fflush(stdout);
scanf("%d", &num1);
printf ("Enter the second number: ");
fflush(stdout);
scanf("%d", &num2);
x = num1;
y = num2;
rem = (num1 % num2);
while (rem != 0)
{
rem = num1 % num2;
if (rem == 0) /* Take special note here! */
{
printf ("The GCD of %d and %d is %d\n", x, y, num2);
}
else
{
num1 = num2;
num2 = rem;
}
}
getchar();
return EXIT_SUCCESS;
}