Advertisement
DacCum

tmp2

Jan 27th, 2022 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2.  
  3. namespace лаба1
  4. {
  5.     class Program
  6.     {
  7.         const double EPS = 1e-7;
  8.         static void Main(string[] args)
  9.         {
  10.             double x, a, c, y;
  11.             Console.Write("Enter x = ");
  12.             x = Convert.ToDouble(Console.ReadLine());
  13.  
  14.             Console.Write("Enter a = ");
  15.             a = Convert.ToDouble(Console.ReadLine());
  16.  
  17.             Console.Write("Enter c = ");
  18.             c = Convert.ToDouble(Console.ReadLine());
  19.  
  20.             if (check(x, a, c))
  21.             {
  22.                 y = f(x, a, c);
  23.                 Console.WriteLine($"Result = {y}");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine(" it is can not be calculated");
  28.             }
  29.         }
  30.         public static double f(double x, double a, double c) =>
  31.  
  32.              sqrt_3(c * x - a) + (Math.Log(x, Math.E)) / (2 * Math.Sin(Math.PI / 3 + x));
  33.  
  34.         public static double sqrt_3(double x)
  35.         {
  36.             if (x < 0) { return -1 * Math.Pow(Math.Abs(x), 1.0 / 3); }
  37.             else { return Math.Pow(x, 1.0 / 3); }
  38.         }
  39.  
  40.         static bool check(double x, double a, double c)
  41.         {
  42.             return (x > EPS && Math.Abs(2 * Math.Sin(Math.PI / 3 + x)) > EPS);
  43.         }
  44.     }
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement