int main(int argc, const char * argv[]) {
int a=20,b=11,x,y,lcm,gcd;
x=a;
y=b;
while (a!=b) {
if (a>b) {
a=a-b;
}
else if (a<b)
{
b=b-a;
}
}
gcd=a;
NSLog(@"gcd=%i",a);
lcm= (x*y)/gcd;
NSLog(@"lcm=%i",lcm);
return 0;
}
Sign up here with your email
ConversionConversion EmoticonEmoticon