Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace mainSolution
- {
- public class MyException : Exception
- {
- public MyException(string messege) : base(message: messege + "\n\n\n Exception founded by Decibit\n\n\n") { }
- public MyException() : base()
- {
- }
- public void Messsage()
- {
- Console.WriteLine("\n\n\n\n\n\n Invalid number, please enter a number from 1 to 12 \n\n\n\n\n\n");
- }
- }
- class Input
- {
- private static IEnumerator<string> getin()
- {
- while (true)
- foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))
- yield return s;
- }
- private IEnumerator<string> inp = getin();
- public string GetString() { inp.MoveNext(); return inp.Current; }
- public int GetInt() { return int.Parse(GetString()); }
- public long GetLong() { return long.Parse(GetString()); }
- public double GetDouble() { return double.Parse(GetString()); }
- }
- static class Program
- {
- static public Input cin = new Input();
- static void Main(string[] args)
- {
- Console.WriteLine("Enter EPS:");
- double EPS = cin.GetDouble();
- Console.WriteLine("№\t x\t F(x)\t\t n");
- for (int step = 0; step <= 10; step++)
- {
- double x = Convert.ToDouble(step) / 10;
- double X = x;
- long fact = 1;
- int i = 2;
- double cur, ans = 1.000000;
- while (true)
- {
- cur = X / fact;
- if (cur < EPS)
- {
- Console.WriteLine($"{step + 1}\t x = {x} F({x}) = {ans:#.######} n = {i}");
- break;
- }
- ans += cur;
- X *= x;
- i++;
- fact *= i;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement