/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner in
= new Scanner
( System .
in ) ;
double x, eps; //Вводит пользователь.
double a, b= 0 , c= 1 ; //Используются для вычислений.
int n= 1 ;
System .
out .
println ( "Введите аргумент x<1 и погрешность eps." ) ; x = in.nextDouble ( ) ;
eps = in.nextDouble ( ) ;
for ( int i
= 1 ; Math .
abs ( a
- b
) >= eps
; i
++ , n
++ ) {
c= c* x; //Степени х.
b= b- c/ i; //Сумма.
}
System .
out .
println ( "Результат в левой части: " + a
) ; System .
out .
println ( "Результат в правой части: " + b
) ; System .
out .
println ( "Количество шагов: " + n
) ; }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCQoJCWRvdWJsZSB4LCBlcHM7Ly/QktCy0L7QtNC40YIg0L/QvtC70YzQt9C+0LLQsNGC0LXQu9GMLgoJCWRvdWJsZSBhLCBiPTAsIGM9MTsvL9CY0YHQv9C+0LvRjNC30YPRjtGC0YHRjyDQtNC70Y8g0LLRi9GH0LjRgdC70LXQvdC40LkuCgkJaW50IG49MTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oItCS0LLQtdC00LjRgtC1INCw0YDQs9GD0LzQtdC90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