wingman007

KrushkovTask163

Sep 25th, 2025 (edited)
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. for (int i = 2; i < 24; i++)
  2. {
  3.     Console.WriteLine($"If a = {i}, b = {i + 1}, c = {i + 2}, d = {i + 3} in interval p = {-(i + 4)}, q = {i + 4}");
  4.     FindSolutions(i, i + 1, i + 2, i + 3, -(i + 4), i + 4);
  5. }
  6.  
  7.  
  8. static void FindSolutions(int a, int b, int c,  int d, int p, int q)
  9. {
  10.     int x, y, z;
  11.     for (x = p; x < q; x++)
  12.     {
  13.         for (y = p; y < q; y++)
  14.         {
  15.             for (z = p; z < q; z++)
  16.             {
  17.                 if(a*x +  b*y + c*z + d == 0) Console.WriteLine($"x = {x} y ={y} z = {z}");
  18.             }
  19.         }
  20.     }
  21. }
  22.  
  23.  
  24.  
  25. //int a = 2, b = 3, c = 4, d = 5 , p = -6, q = 6;
  26. //for (int x = p; x <= q; x++)
  27. //{
  28. //  for (int y = p; y <= q; y++)
  29. //  {
  30. //      for (int z = p; z <= q; z++)
  31. //      {
  32. //          if (a*x + b*y + c*z +d == 0)
  33. //          {
  34. //                Console.WriteLine($"x = {x}, y = {y}, z = {z}");
  35. //          }
  36. //      }
  37. //  }
  38. //}
  39. /*
  40. FindIntegerSolutions(1, 2, 3, 4, -6, 6);
  41.  
  42. static void FindIntegerSolutions(int a, int b, int c, int d, int p, int q)
  43. {
  44.     Console.WriteLine($"Решения на уравнението: {a}x + {b}y + {c}z + {d} = 0 в интервала [{p},{q}]:");
  45.  
  46.     bool found = false;
  47.  
  48.     for (int x = p; x <= q; x++)
  49.     {
  50.         for (int y = p; y <= q; y++)
  51.         {
  52.             for (int z = p; z <= q; z++)
  53.             {
  54.                 if (a * x + b * y + c * z + d == 0)
  55.                 {
  56.                     Console.WriteLine($"x = {x}, y = {y}, z = {z}");
  57.                     found = true;
  58.                 }
  59.             }
  60.         }
  61.     }
  62. }
  63. */
Advertisement
Add Comment
Please, Sign In to add comment