Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Lab1
- {
- class Program
- {
- static double f(double x)
- {
- double s = 0;
- if (x > 3)
- {
- double p = Math.Sin(x);
- double sq = p * p;
- for (int i = 1; i <= 17; i += 2)
- {
- s += p;
- p *= sq;
- }
- return s;
- }
- s = 15;
- double t = x;
- for (int i = 0; i < 5; i++)
- {
- t = Math.Tan(t);
- s += t;
- }
- return s;
- }
- static void Main(string[] args)
- {
- Console.Write("a = ");
- double a = double.Parse(Console.ReadLine());
- Console.Write("b = ");
- double b = double.Parse(Console.ReadLine());
- double fa = f(a);
- double fb = f(b);
- double u = fa > fb ? fa : fb;
- //Console.WriteLine("f(a) = " + fa);
- //Console.WriteLine("f(b) = " + fb);
- Console.WriteLine("u = " + u);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment