public int mdc(int a, int b) { int r; while (a%b != 0) // resto diferente de zero { r = a%b; a = b; b = r; } return b; }