zed_com

Pract_3

Oct 16th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2. namespace console
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             string var;
  9.             double x;
  10.             Console.Write("Выберите формулу:\n1.first\n2.second\n3.third\n");
  11.             var = Console.ReadLine();
  12.             Console.Write("x:");
  13.             x = Convert.ToInt32(Console.ReadLine());
  14.             switch (var)
  15.             {
  16.                 case "first":
  17.                 case "First":
  18.                 case "FIRST":
  19.                     Console.Write("sin^2({0})={1:0.##}",x,Math.Pow(Math.Sin(x),2));
  20.                     break;
  21.                 case "second":
  22.                 case "Second":
  23.                 case "SECOND":
  24.                     Console.Write("log^2({0})={1:0.##}", x, Math.Pow(Math.Log(x), 2));
  25.                     break;
  26.                 case "third":
  27.                 case "Third":
  28.                 case "THIRD":
  29.                     Console.Write("1/cos({0}^3)={1:0.##}", x, 1/Math.Cos(Math.Pow(x,3)));
  30.                     break;
  31.                 default:
  32.                     Console.WriteLine("Проверте правильность написание формулы");
  33.                     break;
  34.             }
  35.             Console.ReadLine();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment