// tossing and dividing
#include<stdio.h>
int main(){
int x, y, z, m, n;
printf("Please enter two numbers: ");
scanf("%d%d", &x, &y);
m = x, n = y;
while (y != 0)
{
z = x%y;
x = y;
y = z;
}
printf("The greatest common divisor is: %d\n", x);
printf("The least common multiple is: %d\ n", m*n / x);
return 0;
}
tossing and turning
#include<stdio.h> //Subtract
int main()
{
int x, y, m, n;
printf("Please enter two numbers: ");
scanf("%d%d", &x, &y );
m = x, n = y;
while (x!=y)
{
if (x>y)
x = xy;
else
y = yx;
}
printf("The greatest common divisor is: %d\n", x) ;
printf("The LCM is: %d\n", m*n / x);
return 0;
}