fork download
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <locale.h>
  4. #include <cmath>
  5. int main()
  6. {
  7. int n, t = 1;
  8. float a, x, eps, y0, y1, y, z = 1;
  9. setlocale(LC_CTYPE, "Russian");
  10. printf_s("Введите первый элемент последовательности:");
  11. scanf_s("%f", &a);
  12. printf_s("Введите значение элемента x:");
  13. scanf_s("%f", &x);
  14. printf_s("Задайте точность вычисления (от 0 до 1):");
  15. scanf_s("%f", &eps);
  16. printf_s("Введите значение элемента n:");
  17. scanf_s("%d", &n);
  18. y0 = a;
  19. while (t < n)
  20. {
  21. z = z * y0;
  22. t++;
  23. }
  24. t = 0;
  25. y1 = y0 + (x / z - y0) / n;
  26. while (abs(y1 * y1 - y0 * y0) >= eps)
  27. {
  28. y0 = y1;
  29. while (t < n)
  30. {
  31. z = z * y0;
  32. t++;
  33. }
  34. t = 0;
  35. y1 = y0 + (x / z - y0) / n;
  36.  
  37. }
  38. y = y1;
  39. printf_s("%f", y);
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:10: fatal error: conio.h: No such file or directory
 #include <conio.h>
          ^~~~~~~~~
compilation terminated.
stdout
Standard output is empty