public void Power(int n) { Drobi result = new Drobi(1, 1); if (n > 0) { for (int i = 0; i < n; i++) { result.x = result.x * x; result.y = result.y * y; } } else if (n < 0) { for (int i = 0; i < Math.Abs(n); i++) { result.x = result.x * x; result.y = result.y * y; } int temp = result.x; result.x = result.y; result.y = temp; } result.Sokr(); result.Show(); } // ненужен
public void Mult(Drobi drobi) // ненужен { Drobi result = new Drobi(); if (drobi.y == 0) { drobi.y = 1; } result.x = x * drobi.x; result.y = y * drobi.y; result.Sokr(); result.Show(); }
public void Minus(Drobi drobi) { Drobi result = new Drobi(); if (y == drobi.y) { result.x = x - drobi.x; result.y = y; } else { result.x = x * drobi.y - drobi.x * y; result.y = y * drobi.y; } result.Sokr(); result.Show(); } // ненужен