Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp7
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double x = Convert.ToDouble(Console.ReadLine());
- while (Math.Abs(x) > 1)
- {
- Console.Write($"x value isn’t in the interval.Input value on interval(-1; 1): ");
- x = Convert.ToDouble(Console.ReadLine());
- }
- double s = 1;
- double cur_num = x;
- for (int i = 2; cur_num >= 0.0001; i += 2)
- {
- double loc_num = x;
- for (int n = 1; n < i; n++)
- {
- loc_num *= x;
- }
- s += loc_num;
- cur_num = loc_num;
- }
- Console.WriteLine($"s == {s}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment