Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.IO;
  5.  
  6. namespace probetest
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. double n, x1, x2, b, c, k, f, x;
  13. Console.WriteLine("Enter n");
  14. n = double.Parse(Console.ReadLine());
  15. Console.WriteLine("Enter x1");
  16. x1 = double.Parse(Console.ReadLine());
  17. Console.WriteLine("Enter x2");
  18. x2 = double.Parse(Console.ReadLine());
  19. x = x1;
  20. k = (x2 - x1) / n;
  21. do
  22. {
  23. Console.WriteLine("Enter b (value 15 is prohibited)");
  24. b = double.Parse(Console.ReadLine());
  25. if (b == 15) Console.WriteLine("b=15 is prohibited");
  26. } while (b == 15);
  27. Console.WriteLine("Enter c");
  28. c = double.Parse(Console.ReadLine());
  29. StreamWriter sw = new StreamWriter("values1.txt");
  30. sw.WriteLine("b=" + b + " c=" + c + " n=" + n + " x1=" + x1 + " x2=" + x2);
  31. for (int i = 0; i < n; i++)
  32. {
  33. f = (Math.Sqrt(c * c - 5 * c + 4) / (b * b - 225)) * (Math.Sin(x) + Math.Cos(x) * Math.Cos(x));
  34. sw.WriteLine("n=" + (i + 1) + " => f=" + f);
  35. x = x + k;
  36. }
  37. sw.Close();
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement