int i=1; double x=-5, eps=Math.pow(0.1, 5), sum=0.0, elem=1.0; do { sum+=elem; elem*=x/i; i++; System.out.println(sum); }while( Math.abs(elem)>=eps); System.out.println(""); sum = 0.0; i=1; x=-5; elem=1.0; do { sum+=elem; elem*=Math.abs(x)/i; i++; System.out.println(1/sum); }while( Math.abs(elem)>=eps); System.out.println(""); sum = 0.0; i=1; x=-5; elem=1.0; double n = 1000.0, s = x/n; do { sum+=elem; elem*=s/i; i++; System.out.println(Math.pow(sum, n)); }while( Math.abs(elem)>=eps);