Advertisement
maxlarin2

lab3

Nov 18th, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. namespace ConsoleApplication1
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             double x, y=0,t;
  8.             int n=0, k = 0;
  9.             Console.WriteLine("Введите xn");
  10.             double xn=double.Parse(Console.ReadLine());
  11.             Console.WriteLine("Введите xk");
  12.             double xk=double.Parse(Console.ReadLine());
  13.             Console.WriteLine("Введите dx");
  14.             double dx=double.Parse(Console.ReadLine());
  15.             Console.WriteLine("Введите e");
  16.             double e=double.Parse(Console.ReadLine());
  17.             Console.WriteLine("|           X         |           Y      |           K        |");
  18.             for (x=xn;x<=xk;x+=dx)
  19.             {
  20.                 if (x > 1)
  21.                 {
  22.                    do
  23.                    {
  24.                        t=Math.PI/2+((Math.Pow(-1,n+1))/((2*n+1)*(Math.Pow(x,(2*n+1)))));
  25.                        y=y+t;
  26.                        n++;
  27.                        k++;
  28.                    }while (t>=e);
  29.                    Console.WriteLine("{0,20}|{1,20}|{2,20}", x,Math.Round(y,8), k);
  30.                    k = 0;
  31.                 }
  32.                
  33.             }
  34.             Console.ReadLine();
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement