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 Экзаменационная_задача
- {
- class Program
- {
- static double Rd(double X,double D)
- {
- double res=0, dblS = 1,dblCur;
- int intCounter=1,intNeg=-1;
- do
- {
- dblCur = intNeg * ((Math.Pow(X, (1 / dblS))) / (intCounter * (intCounter + 1)));
- res +=dblCur;
- Console.WriteLine(intNeg+"*("+X+"^(1/"+dblS+")"+":("+intCounter+"*"+(intCounter+1)+")="+res);
- dblS += 2;
- intNeg *= -1;
- intCounter++;
- }
- while (Math.Abs(dblCur) >= D);
- return res;
- }
- static void Main(string[] args)
- {
- double dblX, dblD,dblS;
- Console.Write("Введите значение X: ");
- dblX = double.Parse(Console.ReadLine());
- Console.Write("Введите значение D: ");
- dblD = double.Parse(Console.ReadLine());
- dblS = Rd(dblX, dblD);
- Console.WriteLine("Полученное значение S: "+dblS);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement