Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 2; i < 24; i++)
- {
- Console.WriteLine($"If a = {i}, b = {i + 1}, c = {i + 2}, d = {i + 3} in interval p = {-(i + 4)}, q = {i + 4}");
- FindSolutions(i, i + 1, i + 2, i + 3, -(i + 4), i + 4);
- }
- static void FindSolutions(int a, int b, int c, int d, int p, int q)
- {
- int x, y, z;
- for (x = p; x < q; x++)
- {
- for (y = p; y < q; y++)
- {
- for (z = p; z < q; z++)
- {
- if(a*x + b*y + c*z + d == 0) Console.WriteLine($"x = {x} y ={y} z = {z}");
- }
- }
- }
- }
- //int a = 2, b = 3, c = 4, d = 5 , p = -6, q = 6;
- //for (int x = p; x <= q; x++)
- //{
- // for (int y = p; y <= q; y++)
- // {
- // for (int z = p; z <= q; z++)
- // {
- // if (a*x + b*y + c*z +d == 0)
- // {
- // Console.WriteLine($"x = {x}, y = {y}, z = {z}");
- // }
- // }
- // }
- //}
- /*
- FindIntegerSolutions(1, 2, 3, 4, -6, 6);
- static void FindIntegerSolutions(int a, int b, int c, int d, int p, int q)
- {
- Console.WriteLine($"Решения на уравнението: {a}x + {b}y + {c}z + {d} = 0 в интервала [{p},{q}]:");
- bool found = false;
- for (int x = p; x <= q; x++)
- {
- for (int y = p; y <= q; y++)
- {
- for (int z = p; z <= q; z++)
- {
- if (a * x + b * y + c * z + d == 0)
- {
- Console.WriteLine($"x = {x}, y = {y}, z = {z}");
- found = true;
- }
- }
- }
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment