Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.IO;
- namespace probetest
- {
- class Program
- {
- static void Main(string[] args)
- {
- double n, x1, x2, b, c, k, f, x;
- Console.WriteLine("Enter n");
- n = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter x1");
- x1 = double.Parse(Console.ReadLine());
- Console.WriteLine("Enter x2");
- x2 = double.Parse(Console.ReadLine());
- x = x1;
- k = (x2 - x1) / n;
- do
- {
- Console.WriteLine("Enter b (value 15 is prohibited)");
- b = double.Parse(Console.ReadLine());
- if (b == 15) Console.WriteLine("b=15 is prohibited");
- } while (b == 15);
- Console.WriteLine("Enter c");
- c = double.Parse(Console.ReadLine());
- StreamWriter sw = new StreamWriter("values1.txt");
- sw.WriteLine("b=" + b + " c=" + c + " n=" + n + " x1=" + x1 + " x2=" + x2);
- for (int i = 0; i < n; i++)
- {
- f = (Math.Sqrt(c * c - 5 * c + 4) / (b * b - 225)) * (Math.Sin(x) + Math.Cos(x) * Math.Cos(x));
- sw.WriteLine("n=" + (i + 1) + " => f=" + f);
- x = x + k;
- }
- sw.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement